我使用页面GUI应用程序在Python Tkinter上设计了一个GUI。每次尝试将输入框中的数据添加到scrolledtreeview中时,都会不断出现错误:
在button3中,我通过命令调用了该函数,该命令似乎有效,但是它无法链接至该函数...而且我真的不知道该怎么做才能使其正常工作...请我的gui也提供另一个solarapp_support.py ...我也不知道该如何添加...为什么我发布链接以防万一您需要...使用gui应用页面生成的两个文件
import sys
try:
from Tkinter import *
except ImportError:
from tkinter import *
try:
import ttk
py3 = False
except ImportError:
import tkinter.ttk as ttk
py3 = True
import RECENT11_support
def vp_start_gui():
'''Starting point when module is the main routine.'''
global val, w, root
root = Tk()
RECENT11_support.set_Tk_var()
top = SOLAR_APP (root)
RECENT11_support.init(root, top)
root.mainloop()
w = None
def create_SOLAR_APP(root, *args, **kwargs):
'''Starting point when module is imported by another program.'''
global w, w_win, rt
rt = root
w = Toplevel (root)
RECENT11_support.set_Tk_var()
top = SOLAR_APP (w)
RECENT11_support.init(w, top, *args, **kwargs)
return (w, top)
def destroy_SOLAR_APP():
global w
w.destroy()
w = None
class SOLAR_APP:
def __init__(self, top=None):
'''This class configures and populates the toplevel window.
top is the toplevel containing window.'''
_bgcolor = '#d9d9d9' # X11 color: 'gray85'
_fgcolor = '#000000' # X11 color: 'black'
_compcolor = '#d9d9d9' # X11 color: 'gray85'
_ana1color = '#d9d9d9' # X11 color: 'gray85'
_ana2color = '#d9d9d9' # X11 color: 'gray85'
font11 = "-family {Book Antiqua} -size 12 -weight bold -slant " \
"roman -underline 0 -overstrike 0"
font12 = "-family {Segoe UI} -size 9 -weight bold -slant roman" \
" -underline 0 -overstrike 0"
self.style = ttk.Style()
if sys.platform == "win32":
self.style.theme_use('winnative')
self.style.configure('.',background=_bgcolor)
self.style.configure('.',foreground=_fgcolor)
self.style.configure('.',font="TkDefaultFont")
self.style.map('.',background=
[('selected', _compcolor), ('active',_ana2color)])
top.geometry("596x478+403+138")
top.title("SOLAR APP")
top.configure(relief="ridge")
top.configure(background="#d9d9d9")
top.configure(highlightbackground="#d9d9d9")
top.configure(highlightcolor="black")
def insert_data(self):
self.Scrolledtreeview1.insert('self.TNotebook1_t0', 'end', text=str(self.i),
values=(
self.Entry1.get(), self.Entry2.get(), self.Entry3.get(),
self.Entry4.get()))
# Increment counter
self.i = self.i + 1
self.Button1 = Button(top)
self.Button1.place(relx=0.86, rely=0.69, height=34, width=67)
self.Button1.configure(activebackground="#d9d9d9")
self.Button1.configure(activeforeground="#000000")
self.Button1.configure(background="#d9d9d9")
self.Button1.configure(disabledforeground="#a3a3a3")
self.Button1.configure(foreground="#000000")
self.Button1.configure(highlightbackground="#d9d9d9")
self.Button1.configure(highlightcolor="black")
self.Button1.configure(pady="0")
self.Button1.configure(text='''FINISH''')
self.Button2 = Button(top)
self.Button2.place(relx=0.86, rely=0.88, height=34, width=67)
self.Button2.configure(activebackground="#d9d9d9")
self.Button2.configure(activeforeground="#000000")
self.Button2.configure(background="#d9d9d9")
self.Button2.configure(disabledforeground="#a3a3a3")
self.Button2.configure(foreground="#000000")
self.Button2.configure(highlightbackground="#d9d9d9")
self.Button2.configure(highlightcolor="black")
self.Button2.configure(pady="0")
self.Button2.configure(text='''PRINT''')
self.style.configure('TNotebook.Tab', background=_bgcolor)
self.style.configure('TNotebook.Tab', foreground=_fgcolor)
self.style.map('TNotebook.Tab', background=
[('selected', _compcolor), ('active',_ana2color)])
self.TNotebook1 = ttk.Notebook(top)
self.TNotebook1.place(relx=0.02, rely=0.0, relheight=0.95, relwidth=0.82)
self.TNotebook1.configure(width=486)
self.TNotebook1.configure(takefocus="")
self.TNotebook1_t0 = Frame(self.TNotebook1)
self.TNotebook1.add(self.TNotebook1_t0, padding=3)
self.TNotebook1.tab(0, text="LOAD SETUP", compound="none", underline="-1"
,)
self.TNotebook1_t0.configure(background="#d9d9d9")
self.TNotebook1_t0.configure(highlightbackground="#d9d9d9")
self.TNotebook1_t0.configure(highlightcolor="black")
self.TNotebook1_t1 = Frame(self.TNotebook1)
self.TNotebook1.add(self.TNotebook1_t1, padding=3)
self.TNotebook1.tab(1, text="BATTERY SETUP", compound="left"
,underline="-1", )
self.TNotebook1_t1.configure(background="#d9d9d9")
self.TNotebook1_t1.configure(highlightbackground="#d9d9d9")
self.TNotebook1_t1.configure(highlightcolor="black")
self.TNotebook1_t2 = Frame(self.TNotebook1)
self.TNotebook1.add(self.TNotebook1_t2, padding=3)
self.TNotebook1.tab(2, text="PANEL SETUP", compound="none", underline="-1"
,)
self.TNotebook1_t2.configure(background="#d9d9d9")
self.TNotebook1_t2.configure(highlightbackground="#d9d9d9")
self.TNotebook1_t2.configure(highlightcolor="black")
self.TNotebook1_t3 = Frame(self.TNotebook1)
self.TNotebook1.add(self.TNotebook1_t3, padding=3)
self.TNotebook1.tab(3, text="INVERTER SETUP", compound="none"
,underline="-1", )
self.TNotebook1_t3.configure(background="#d9d9d9")
self.TNotebook1_t3.configure(highlightbackground="#d9d9d9")
self.TNotebook1_t3.configure(highlightcolor="black")
self.Entry1 = Entry(self.TNotebook1_t0)
self.Entry1.place(relx=0.02, rely=0.07,height=30, relwidth=0.22)
self.Entry1.configure(background="white")
self.Entry1.configure(disabledforeground="#a3a3a3")
self.Entry1.configure(font="TkFixedFont")
self.Entry1.configure(foreground="#000000")
self.Entry1.configure(highlightbackground="#d9d9d9")
self.Entry1.configure(highlightcolor="black")
self.Entry1.configure(insertbackground="black")
self.Entry1.configure(selectbackground="#c4c4c4")
self.Entry1.configure(selectforeground="black")
self.Entry2 = Entry(self.TNotebook1_t0)
self.Entry2.place(relx=0.27, rely=0.07,height=30, relwidth=0.13)
self.Entry2.configure(background="white")
self.Entry2.configure(disabledforeground="#a3a3a3")
self.Entry2.configure(font="TkFixedFont")
self.Entry2.configure(foreground="#000000")
self.Entry2.configure(highlightbackground="#d9d9d9")
self.Entry2.configure(highlightcolor="black")
self.Entry2.configure(insertbackground="black")
self.Entry2.configure(selectbackground="#c4c4c4")
self.Entry2.configure(selectforeground="black")
self.Entry3 = Entry(self.TNotebook1_t0)
self.Entry3.place(relx=0.44, rely=0.07,height=30, relwidth=0.11)
self.Entry3.configure(background="white")
self.Entry3.configure(disabledforeground="#a3a3a3")
self.Entry3.configure(font="TkFixedFont")
self.Entry3.configure(foreground="#000000")
self.Entry3.configure(highlightbackground="#d9d9d9")
self.Entry3.configure(highlightcolor="black")
self.Entry3.configure(insertbackground="black")
self.Entry3.configure(selectbackground="#c4c4c4")
self.Entry3.configure(selectforeground="black")
self.Entry4 = Entry(self.TNotebook1_t0)
self.Entry4.place(relx=0.61, rely=0.07,height=30, relwidth=0.09)
self.Entry4.configure(background="white")
self.Entry4.configure(disabledforeground="#a3a3a3")
self.Entry4.configure(font="TkFixedFont")
self.Entry4.configure(foreground="#000000")
self.Entry4.configure(highlightbackground="#d9d9d9")
self.Entry4.configure(highlightcolor="black")
self.Entry4.configure(insertbackground="black")
self.Entry4.configure(selectbackground="#c4c4c4")
self.Entry4.configure(selectforeground="black")
self.Label1 = Label(self.TNotebook1_t0)
self.Label1.place(relx=0.08, rely=0.17, height=21, width=44)
self.Label1.configure(activebackground="#f9f9f9")
self.Label1.configure(activeforeground="black")
self.Label1.configure(background="#d9d9d9")
self.Label1.configure(disabledforeground="#a3a3a3")
self.Label1.configure(foreground="#000000")
self.Label1.configure(highlightbackground="#d9d9d9")
self.Label1.configure(highlightcolor="black")
self.Label1.configure(text='''ITEM''')
self.Label2 = Label(self.TNotebook1_t0)
self.Label2.place(relx=0.27, rely=0.17, height=21, width=61)
self.Label2.configure(activebackground="#f9f9f9")
self.Label2.configure(activeforeground="black")
self.Label2.configure(background="#d9d9d9")
self.Label2.configure(disabledforeground="#a3a3a3")
self.Label2.configure(foreground="#000000")
self.Label2.configure(highlightbackground="#d9d9d9")
self.Label2.configure(highlightcolor="black")
self.Label2.configure(text='''WATTAGE''')
self.Label3 = Label(self.TNotebook1_t0)
self.Label3.place(relx=0.46, rely=0.17, height=21, width=29)
self.Label3.configure(activebackground="#f9f9f9")
self.Label3.configure(activeforeground="black")
self.Label3.configure(background="#d9d9d9")
self.Label3.configure(disabledforeground="#a3a3a3")
self.Label3.configure(foreground="#000000")
self.Label3.configure(highlightbackground="#d9d9d9")
self.Label3.configure(highlightcolor="black")
self.Label3.configure(text='''QTY''')
self.Label4 = Label(self.TNotebook1_t0)
self.Label4.place(relx=0.61, rely=0.17, height=21, width=53)
self.Label4.configure(activebackground="#f9f9f9")
self.Label4.configure(activeforeground="black")
self.Label4.configure(background="#d9d9d9")
self.Label4.configure(disabledforeground="#a3a3a3")
self.Label4.configure(foreground="#000000")
self.Label4.configure(highlightbackground="#d9d9d9")
self.Label4.configure(highlightcolor="black")
self.Label4.configure(text='''HOUR(S)''')
self.style.configure('Treeview.Heading', font="TkDefaultFont")
self.Scrolledtreeview1 = ScrolledTreeView(self.TNotebook1_t0)
self.Scrolledtreeview1.place(relx=0.0, rely=0.31, relheight=0.7
, relwidth=1.0)
self.Scrolledtreeview1.configure(columns="Col1 Col2 Col3 Col4")
self.Scrolledtreeview1.heading("#0",text="S/N")
self.Scrolledtreeview1.heading("#0",anchor="center")
self.Scrolledtreeview1.column("#0",width="35")
self.Scrolledtreeview1.column("#0",minwidth="20")
self.Scrolledtreeview1.column("#0",stretch="1")
self.Scrolledtreeview1.column("#0",anchor="w")
self.Scrolledtreeview1.heading("Col1",text="ITEM")
self.Scrolledtreeview1.heading("Col1",anchor="center")
self.Scrolledtreeview1.column("Col1",width="180")
self.Scrolledtreeview1.column("Col1",minwidth="20")
self.Scrolledtreeview1.column("Col1",stretch="1")
self.Scrolledtreeview1.column("Col1",anchor="w")
self.Scrolledtreeview1.heading("Col2",text="WATTAGE")
self.Scrolledtreeview1.heading("Col2",anchor="center")
self.Scrolledtreeview1.column("Col2",width="90")
self.Scrolledtreeview1.column("Col2",minwidth="20")
self.Scrolledtreeview1.column("Col2",stretch="1")
self.Scrolledtreeview1.column("Col2",anchor="w")
self.Scrolledtreeview1.heading("Col3",text="QTY")
self.Scrolledtreeview1.heading("Col3",anchor="center")
self.Scrolledtreeview1.column("Col3",width="40")
self.Scrolledtreeview1.column("Col3",minwidth="20")
self.Scrolledtreeview1.column("Col3",stretch="1")
self.Scrolledtreeview1.column("Col3",anchor="w")
self.Scrolledtreeview1.heading("Col4",text="HOUR(s)")
self.Scrolledtreeview1.heading("Col4",anchor="center")
self.Scrolledtreeview1.column("Col4",width="90")
self.Scrolledtreeview1.column("Col4",minwidth="20")
self.Scrolledtreeview1.column("Col4",stretch="1")
self.Scrolledtreeview1.column("Col4",anchor="w")
self.i = 0
self.Button3 = Button(self.TNotebook1_t0)
self.Button3.place(relx=0.82, rely=0.02, height=44, width=77)
self.Button3.configure(activebackground="#d9d9d9")
self.Button3.configure(activeforeground="#000000")
self.Button3.configure(background="#d9d9d9")
self.Button3.configure(command=insert_data)
self.Button3.configure(disabledforeground="#a3a3a3")
self.Button3.configure(font=font11)
self.Button3.configure(foreground="#000000")
self.Button3.configure(highlightbackground="#d9d9d9")
self.Button3.configure(highlightcolor="black")
self.Button3.configure(pady="0")
self.Button3.configure(text='''ADD''')
self.Button4 = Button(self.TNotebook1_t0)
self.Button4.place(relx=0.88, rely=0.17, height=34, width=47)
self.Button4.configure(activebackground="#d9d9d9")
self.Button4.configure(activeforeground="#000000")
self.Button4.configure(background="#d9d9d9")
self.Button4.configure(disabledforeground="#a3a3a3")
self.Button4.configure(font=font12)
self.Button4.configure(foreground="#000000")
self.Button4.configure(highlightbackground="#d9d9d9")
self.Button4.configure(highlightcolor="black")
self.Button4.configure(pady="0")
self.Button4.configure(text='''DELETE''')
self.Label9 = Label(self.TNotebook1_t1)
self.Label9.place(relx=0.04, rely=0.12, height=21, width=128)
self.Label9.configure(activebackground="#f9f9f9")
self.Label9.configure(activeforeground="black")
self.Label9.configure(background="#d9d9d9")
self.Label9.configure(disabledforeground="#a3a3a3")
self.Label9.configure(foreground="#000000")
self.Label9.configure(highlightbackground="#d9d9d9")
self.Label9.configure(highlightcolor="black")
self.Label9.configure(text='''BATTERY RATING (AH)''')
self.Label10 = Label(self.TNotebook1_t1)
self.Label10.place(relx=0.06, rely=0.24, height=21, width=124)
self.Label10.configure(activebackground="#f9f9f9")
self.Label10.configure(activeforeground="black")
self.Label10.configure(background="#d9d9d9")
self.Label10.configure(disabledforeground="#a3a3a3")
self.Label10.configure(foreground="#000000")
self.Label10.configure(highlightbackground="#d9d9d9")
self.Label10.configure(highlightcolor="black")
self.Label10.configure(text='''BATTERY VOLTAGE(V)''')
self.Label11 = Label(self.TNotebook1_t1)
self.Label11.place(relx=0.04, rely=0.35, height=21, width=124)
self.Label11.configure(activebackground="#f9f9f9")
self.Label11.configure(activeforeground="black")
self.Label11.configure(background="#d9d9d9")
self.Label11.configure(disabledforeground="#a3a3a3")
self.Label11.configure(foreground="#000000")
self.Label11.configure(highlightbackground="#d9d9d9")
self.Label11.configure(highlightcolor="black")
self.Label11.configure(text='''DAYS OF AUTONOMY''')
self.Label12 = Label(self.TNotebook1_t1)
self.Label12.place(relx=0.06, rely=0.47, height=21, width=103)
self.Label12.configure(activebackground="#f9f9f9")
self.Label12.configure(activeforeground="black")
self.Label12.configure(background="#d9d9d9")
self.Label12.configure(disabledforeground="#a3a3a3")
self.Label12.configure(foreground="#000000")
self.Label12.configure(highlightbackground="#d9d9d9")
self.Label12.configure(highlightcolor="black")
self.Label12.configure(text='''DISCHARGE LEVEL''')
self.Entry8 = Entry(self.TNotebook1_t1)
self.Entry8.place(relx=0.36, rely=0.12,height=20, relwidth=0.34)
self.Entry8.configure(background="white")
self.Entry8.configure(disabledforeground="#a3a3a3")
self.Entry8.configure(font="TkFixedFont")
self.Entry8.configure(foreground="#000000")
self.Entry8.configure(highlightbackground="#d9d9d9")
self.Entry8.configure(highlightcolor="black")
self.Entry8.configure(insertbackground="black")
self.Entry8.configure(selectbackground="#c4c4c4")
self.Entry8.configure(selectforeground="black")
self.Entry9 = Entry(self.TNotebook1_t1)
self.Entry9.place(relx=0.36, rely=0.24,height=20, relwidth=0.34)
self.Entry9.configure(background="white")
self.Entry9.configure(disabledforeground="#a3a3a3")
self.Entry9.configure(font="TkFixedFont")
self.Entry9.configure(foreground="#000000")
self.Entry9.configure(highlightbackground="#d9d9d9")
self.Entry9.configure(highlightcolor="black")
self.Entry9.configure(insertbackground="black")
self.Entry9.configure(selectbackground="#c4c4c4")
self.Entry9.configure(selectforeground="black")
self.Entry10 = Entry(self.TNotebook1_t1)
self.Entry10.place(relx=0.36, rely=0.35,height=20, relwidth=0.34)
self.Entry10.configure(background="white")
self.Entry10.configure(disabledforeground="#a3a3a3")
self.Entry10.configure(font="TkFixedFont")
self.Entry10.configure(foreground="#000000")
self.Entry10.configure(highlightbackground="#d9d9d9")
self.Entry10.configure(highlightcolor="black")
self.Entry10.configure(insertbackground="black")
self.Entry10.configure(selectbackground="#c4c4c4")
self.Entry10.configure(selectforeground="black")
self.Spinbox1 = Spinbox(self.TNotebook1_t1, from_=50.0, to=80.0)
self.Spinbox1.place(relx=0.36, rely=0.47, relheight=0.04, relwidth=0.09)
self.Spinbox1.configure(activebackground="#f9f9f9")
self.Spinbox1.configure(background="white")
self.Spinbox1.configure(buttonbackground="#d9d9d9")
self.Spinbox1.configure(disabledforeground="#a3a3a3")
self.Spinbox1.configure(foreground="black")
self.Spinbox1.configure(from_="50.0")
self.Spinbox1.configure(highlightbackground="black")
self.Spinbox1.configure(highlightcolor="black")
self.Spinbox1.configure(increment="15.0")
self.Spinbox1.configure(insertbackground="black")
self.Spinbox1.configure(selectbackground="#c4c4c4")
self.Spinbox1.configure(selectforeground="black")
self.Spinbox1.configure(textvariable=RECENT11_support.spinbox)
self.Spinbox1.configure(to="80.0")
self.Spinbox1.configure(width=5)
self.Spinbox1.configure(wrap=1)
self.Label13 = Label(self.TNotebook1_t1)
self.Label13.place(relx=0.46, rely=0.47, height=21, width=16)
self.Label13.configure(activebackground="#f9f9f9")
self.Label13.configure(activeforeground="black")
self.Label13.configure(background="#d9d9d9")
self.Label13.configure(disabledforeground="#a3a3a3")
self.Label13.configure(foreground="#000000")
self.Label13.configure(highlightbackground="#d9d9d9")
self.Label13.configure(highlightcolor="black")
self.Label13.configure(text='''%''')
self.Label14 = Label(self.TNotebook1_t2)
self.Label14.place(relx=0.15, rely=0.21, height=21, width=87)
self.Label14.configure(activebackground="#f9f9f9")
self.Label14.configure(activeforeground="black")
self.Label14.configure(background="#d9d9d9")
self.Label14.configure(disabledforeground="#a3a3a3")
self.Label14.configure(foreground="#000000")
self.Label14.configure(highlightbackground="#d9d9d9")
self.Label14.configure(highlightcolor="black")
self.Label14.configure(text='''PANEL RATING''')
self.Label15 = Label(self.TNotebook1_t2)
self.Label15.place(relx=0.13, rely=0.31, height=21, width=96)
self.Label15.configure(activebackground="#f9f9f9")
self.Label15.configure(activeforeground="black")
self.Label15.configure(background="#d9d9d9")
self.Label15.configure(disabledforeground="#a3a3a3")
self.Label15.configure(foreground="#000000")
self.Label15.configure(highlightbackground="#d9d9d9")
self.Label15.configure(highlightcolor="black")
self.Label15.configure(text='''PANEL VOLTAGE''')
self.Entry11 = Entry(self.TNotebook1_t2)
self.Entry11.place(relx=0.44, rely=0.21,height=20, relwidth=0.34)
self.Entry11.configure(background="white")
self.Entry11.configure(disabledforeground="#a3a3a3")
self.Entry11.configure(font="TkFixedFont")
self.Entry11.configure(foreground="#000000")
self.Entry11.configure(highlightbackground="#d9d9d9")
self.Entry11.configure(highlightcolor="black")
self.Entry11.configure(insertbackground="black")
self.Entry11.configure(selectbackground="#c4c4c4")
self.Entry11.configure(selectforeground="black")
# The following code is added to facilitate the Scrolled widgets you specified.
class AutoScroll(object):
'''Configure the scrollbars for a widget.'''
def __init__(self, master):
# Rozen. Added the try-except clauses so that this class
# could be used for scrolled entry widget for which vertical
# scrolling is not supported. 5/7/14.
try:
vsb = ttk.Scrollbar(master, orient='vertical', command=self.yview)
except:
pass
hsb = ttk.Scrollbar(master, orient='horizontal', command=self.xview)
#self.configure(yscrollcommand=_autoscroll(vsb),
# xscrollcommand=_autoscroll(hsb))
try:
self.configure(yscrollcommand=self._autoscroll(vsb))
except:
pass
self.configure(xscrollcommand=self._autoscroll(hsb))
self.grid(column=0, row=0, sticky='nsew')
try:
vsb.grid(column=1, row=0, sticky='ns')
except:
pass
hsb.grid(column=0, row=1, sticky='ew')
master.grid_columnconfigure(0, weight=1)
master.grid_rowconfigure(0, weight=1)
# Copy geometry methods of master (taken from ScrolledText.py)
if py3:
methods = Pack.__dict__.keys() | Grid.__dict__.keys() \
| Place.__dict__.keys()
else:
methods = Pack.__dict__.keys() + Grid.__dict__.keys() \
+ Place.__dict__.keys()
for meth in methods:
if meth[0] != '_' and meth not in ('config', 'configure'):
setattr(self, meth, getattr(master, meth))
@staticmethod
def _autoscroll(sbar):
'''Hide and show scrollbar as needed.'''
def wrapped(first, last):
first, last = float(first), float(last)
if first <= 0 and last >= 1:
sbar.grid_remove()
else:
sbar.grid()
sbar.set(first, last)
return wrapped
def __str__(self):
return str(self.master)
def _create_container(func):
'''Creates a ttk Frame with a given master, and use this new frame to
place the scrollbars and the widget.'''
def wrapped(cls, master, **kw):
container = ttk.Frame(master)
return func(cls, container, **kw)
return wrapped
class ScrolledTreeView(AutoScroll, ttk.Treeview):
'''A standard ttk Treeview widget with scrollbars that will
automatically show/hide as needed.'''
@_create_container
def __init__(self, master, **kw):
ttk.Treeview.__init__(self, master, **kw)
AutoScroll.__init__(self, master)
if __name__ == '__main__':
vp_start_gui()
答案 0 :(得分:0)
我在这里看到一些问题。由于我们不知道RECENT11_support
中的内容,因此无法测试您的代码。否则,您的代码将无法启动。我可以看到Button3
的命令无效。
self.Button3.configure(command=insert_data)
应该是:
self.Button3.configure(command=self.insert_data)
这表示您无需在小部件上的单独行上配置每个选项。那只是两种方式的代码。您可以在一行上完成所有操作。
例如:
self.Button1 = Button(top)
self.Button1.place(relx=0.86, rely=0.69, height=34, width=67)
self.Button1.configure(activebackground="#d9d9d9")
self.Button1.configure(activeforeground="#000000")
self.Button1.configure(background="#d9d9d9")
self.Button1.configure(disabledforeground="#a3a3a3")
self.Button1.configure(foreground="#000000")
self.Button1.configure(highlightbackground="#d9d9d9")
self.Button1.configure(highlightcolor="black")
self.Button1.configure(pady="0")
self.Button1.configure(text='''FINISH''')
应该看起来像这样:
self.Button1 = Button(top, text='''FINISH''', activebackground="#d9d9d9", activeforeground="#000000",
background="#d9d9d9", disabledforeground="#a3a3a3", disabledforeground="#a3a3a3",
foreground="#000000", highlightbackground="#d9d9d9", highlightcolor="black")
self.Button1.place(relx=0.86, rely=0.69, height=34, width=67)
说实话,如果您使用的是GUI生成器,那么我不确定我们能为您提供帮助。 如果您不知道代码的工作方式或无法自行阅读,则可能无法修复它。您对GUI生成器所做的任何更改都可能导致相同的中断。
您的GUI生成器还使用了place()
之类的东西,在大多数应用程序中,对于简单地放置小部件,实际上并不需要它。我认为您最好学习如何用代码自己构建GUI,否则我们将无法真正为您解决问题。