python - 使用 pycharm 的 Python 程序未在 sublime 文本上运行
问题描述
这是我在 sublime 上使用的代码。我确保 python 在我的路径上,并且在 sublime 上构建它之前立即安装了 pysql3。请原谅语言(西班牙语),但其余代码应该对任何熟悉 python 的人都可以区分。当我构建代码时,我只是给了它在命令行中花费的时间,实际上什么都没有出现,即使应该有。
from tkinter import *
from tkinter import filedialog
import sqlite3
root = Tk()
root.title('Project')
root.geometry("500x450")
# Creation of the database
connection = sqlite3.connect('Pydbtest.db')
curs = connection.cursor()
# Table creation
'''
curs.execute ("""Create Table addresses(
first_name text,
last_name text,
address text,
city text,
state text,
zipcode integer
)""")
'''
# Creacion de la funcion de enviar para base de datos
def enviar():
# Suprimir las cajas de texto
nombre.delete(0, END)
apellido.delete(0, END)
dirrecion.delete(0, END)
ciudad.delete(0, END)
pais.delete(0, END)
codigopostal.delete(0, END)
# Caja de text
nombre = Entry(root, width=30)
nombre.grid(row=1, column=1, padx=20)
apellido = Entry(root, width=30)
apellido.grid(row=2, column=1, padx=20)
dirrecion = Entry(root, width=30)
dirrecion.grid(row=3, column=1, padx=20)
ciudad = Entry(root, width=30)
ciudad.grid(row=4, column=1, padx=20)
pais = Entry(root, width=30)
pais.grid(row=5, column=1, padx=20)
codigopostal = Entry(root, width=30)
codigopostal.grid(row=6, column=1, padx=20)
# Creacion para etiqueta de caja
nombrelabel = Label(root, text="Nombre")
nombrelabel.grid(row=1, column=0)
apellidolabel = Label(root, text="Apellido")
apellidolabel.grid(row=2, column=0)
dirrecionlabel = Label(root, text="Dirrecion")
dirrecionlabel.grid(row=3, column=0)
ciudadlabel = Label(root, text="Ciudad")
ciudadlabel.grid(row=4, column=0)
paislabel = Label(root, text="Pais")
paislabel.grid(row=5, column=0)
codigopostallabel = Label(root, text="Codigo Postal")
codigopostallabel.grid(row=6, column=0)
# Creacion para boton de enviar
enviar_btn = Button(root, text="Anadir a la base de datos")
enviar_btn.grid(row=6, column=0, columnspan=2, pady=10, padx=10, ipadx=100)
# Make commit to db
connection.commit()
# End connection to db
connection.close()
解决方案
推荐阅读
- pandas - 当键不在索引中时,如何(惯用地)使用 pandas .loc 返回一个空数据框
- python - 安装 OpenCV 失败,因为它找不到“skbuild”
- mongodb - 如何在 nginx 容器中启用流模块
- jsf - 如何使 ajax 在 t:datatable 列中工作,其中 t:datatable 位于 t:datalist 中?
- python - 打开具有绝对路径的文件时出现 FileNotFoundError
- python - 错误,“[错误] 33#33: *92500 connect() failed (111: Connection denied) while connection to upstream, client: 216.58.212.244, server: #1906
- adb - 如何删除 ADB 中存储的用户帐户?
- apache - Elasticbeanstalk - Apache 配置
- json - 预计解码数组
但找到了一本字典。读取 JSON 时出现问题 - html - 如何将文本链接到另一个页面