如何在使用tkinter的Python GUI中强制进行帧刷新/重画? 当用户单击菜单按钮时,会回调函数。 我想要的不是调用函数,而是框架区域应该像用户单击新客户一样重新绘制,应该绘制预订表单,如果用户单击来宾列表,那么应该绘制来宾列表表。 我想菜单栏显示在每一帧。
"如何在使用tkinter的Python GUI中强制进行帧刷新/重画? 当用户单击菜单按钮时,会回调函数。 我想要的不是调用函数,而是框架区域应该像用户单击新客户一样重新绘制,应该绘制预订表单,如果用户单击来宾列表,那么应该绘制来宾列表表。 我想菜单栏显示在每一帧。,python,user-interface,tkinter,Python,User Interface,Tkinter," `单击菜单按钮时,您应该描述您想要什么样的表单。您已经告诉我们您想要什么,但实际上您还没有提出任何问题。您不了解问题的哪一部分?让菜单按钮回调进行您想要的重画。来宾列表框可能会弹出一个菜单框或新的顶层。我想要一个带有输入字段和复选框的from。 class NewMenu(Frame): def __init__(self,parent=None): Frame.__init__(self, parent) self.pack(expand=YES, fill=BOTH)
`单击菜单按钮时,您应该描述您想要什么样的表单。您已经告诉我们您想要什么,但实际上您还没有提出任何问题。您不了解问题的哪一部分?让菜单按钮回调进行您想要的重画。来宾列表框可能会弹出一个菜单框或新的顶层。我想要一个带有输入字段和复选框的from。
class NewMenu(Frame):
def __init__(self,parent=None):
Frame.__init__(self, parent)
self.pack(expand=YES, fill=BOTH)
self.createWidget()
self.master.title("Hotel Ganga Maiya-Hotel_ERP")
self.master.iconname("tkpython")
def createWidget(self):
self.makeMenuBar()
self.makeToolBar()
L = Label(self, text='Welcome Back')
L.config(relief=SUNKEN, width=100, height=20, bg='white')
L.pack(expand=YES,fill=BOTH)
def makeToolBar(self):
toolbar = Frame(self, cursor='hand2', relief=SUNKEN, bd=2)
toolbar.pack(side=BOTTOM, fill=X)
Button(toolbar, text='Quit', command=self.quit) .pack(side=RIGHT)
Button(toolbar, text='Engage Room', command=self.greeting) .pack(side=LEFT)
def makeMenuBar(self):
self.menubar = Menu(self.master)
self.master.config(menu= self.menubar)
self.bookRoomMenu()
self.viewDataMenu()
self.accountingMenu()
self.imageMenu()
self.billingMenu()
def bookRoomMenu(self):
pulldown= Menu(self.menubar)
pulldown.add_command(label='New Customer', command=self.notdone)
pulldown.add_command(label= 'Old Customer', command=self.quit)
self.menubar.add_cascade(label='Book Room', underline=0, menu=pulldown)
def viewDataMenu(self):
pulldown = Menu(self.menubar)
pulldown.add_command(label= 'Room Number Wise', command=self.notdone)
pulldown.add_command(label= 'Room Category Wise' , command=self.greeting)
# pulldown.add_separator()
# pulldown.add_command(label='Delete', command=self.greeting)
#pulldown.entryconfig(4, state=DISABLED)
self.menubar.add_cascade(label='Booking History', underline=0, menu=pulldown)
def accountingMenu(self):
pulldown= Menu(self.menubar)
pulldown.add_command(label='Account Calculater', command=self.notdone)
pulldown.add_command(label= 'Some thing', command=self.notdone)
self.menubar.add_cascade(label='Accounting', underline=0, menu=pulldown)
def imageMenu(self):
self.menubar.add_cascade(label='Guest list', underline=0, )
# photoFiles = ('nike.png','adidas.png','Avira.png')
# pulldown = Menu(self.menubar)
#self.photoObjs=[]
#for file in photoFiles:
# img = PhotoImage(file='C:/Users/CyberSurvillence/Documents/img/' + file)
# pulldown.add_command(image=img, command=self.notdone)
# self.photoObjs.append(img)
#self.menubar.add_cascade(label='Guest List', underline=0, menu=pulldown)
def billingMenu(self):
#pulldown= Menu(self.menubar)
# pulldown.add_command(label='Account Calculater', command=self.notdone)
# pulldown.add_command(label= 'Some thing', command=self.notdone)
self.menubar.add_cascade(label='Billing', underline=0, )
def greeting(self):
showinfo('greeting','Greeting')
def notdone(self):
showerror('Not implemented','Not yet available')
def quit(self):
if askyesno('Verity quit','Are you sure you want to quit?'):
Frame.quit(self)
if __name__ == '__main__': NewMenu().mainloop()