我目前正在为学校开展一个课程作业项目,它是一个数据库系统,具有使用 Tkinter、Python 和 SQLite3 的用户界面。我使用此函数关闭窗口,但显示以下错误。我附上了一段代码和一张表格的照片。
Tkinter 回调中的异常 回溯(最近一次调用最后一次): 文件“C:\Users\Ryan\AppData\Local\Programs\Python\Python38-32\lib\tkinter_init_.py”,第 1883 行,调用 返回 self.func(*args) 类型错误:quit() 接受 0 个位置参数,但给出了 1 个
import sys
try:
import Tkinter as tk
except ImportError:
import tkinter as tk
try:
import ttk
py3 = False
except ImportError:
import tkinter.ttk as ttk
py3 = True
from PIL import Image, ImageTk
import CustomerForm_support
import os.path
import sqlite3
import tkinter.messagebox
def vp_start_gui():
'''Starting point when module is the main routine.'''
global val, w, root
global prog_location
prog_call = sys.argv[0]
prog_location = os.path.split(prog_call)[0]
root = tk.Tk()
top = CustomerForm (root)
CustomerForm_support.init(root, top)
root.mainloop()
w = None
def create_CustomerForm(rt, *args, **kwargs):
'''Starting point when module is imported by another module.
Correct form of call: 'create_CustomerForm(root, *args, **kwargs)' .'''
global w, w_win, root
global prog_location
prog_call = sys.argv[0]
prog_location = os.path.split(prog_call)[0]
#rt = root
root = rt
w = tk.Toplevel (root)
top = CustomerForm (w)
CustomerForm_support.init(w, top, *args, **kwargs)
return (w, top)
class CustomerForm:
def quit():
root.quit()
答案 0 :(得分:2)
基本类错误。所有方法都必须将“self”作为第一个参数。
Twig\Extensions\ArrayExtension: null
Twig\Extensions\DateExtension: null
Twig\Extensions\IntlExtension: null
Twig\Extensions\TextExtension: null