首页 > 解决方案 > 使用 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()

标签: pythondatabaseuser-interfacesublimetext3pysqlite

解决方案


推荐阅读