【发布时间】:2020-06-09 20:15:12
【问题描述】:
它没有给出任何错误只是没有出现如果它看起来有点波涛汹涌很抱歉感到沮丧但实际上一切正常都没有错误它甚至进入露营者ID但没有名字有人请帮助,谢谢,不要记下这个尽管大多数人实际上并没有阅读代码 [已修复]
import tkinter
from tkinter import *
import random
from random import randint
import sqlite3
from sqlite3 import *
#creating screen
page = tkinter.Tk()
#naming screen
page.title('Camp Sign-up')
#setting screen size
page.geometry("1000x500")
#creating text
Title = tkinter.Label(page, text='Registration', font=('arial') ).pack()
FullName = tkinter.Label(page, text='Full Name:', font=('arial')).place(x=110, y=50)
full = StringVar()
FullNameValue = Entry(page, textvar=full, width=25,).place(x=200, y=53)
CamperID = random.randint(100000, 1000000)
#Database
conn = sqlite3.connect('YouthCamp.db')
c = conn.cursor()
def createtable():
c.execute("""CREATE TABLE Registration (
CampID INT,
full TEXT,
)""")
try:
createtable()
except:
sqlite3.OperationalError
#button
def buttonclick():
#heres where you lnk where you want your info to go
FullNameValu= full.get()
conn = sqlite3.connect('YouthCamp.db')
c = conn.cursor()
c.execute("INSERT INTO Registration(CampID, full)VALUES(?, ?)",(CamperID, FullNameValu))
conn.commit()
#button
work = Button(page, text='Submit', width=10, height=2, bg='lightgrey',
command=buttonclick()).place(x=475, y=450)
#heres where you execute your close files commands
conn.commit()
c.close()
conn.close()
#ending code never put this above anything
page.mainloop()
【问题讨论】:
标签: python python-3.x sqlite tkinter