亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我的課程中的 tkinter 小部件沒有顯示

我的課程中的 tkinter 小部件沒有顯示

HUH函數 2021-09-25 13:21:22
我正在嘗試編寫一個包含多個頁面并且可以在單擊按鈕時切換到的代碼。它最初有效,但我的小部件沒有顯示,并且既沒有警告也沒有錯誤消息。其次,使用tk和tk.TK有什么區別?from tkinter import *import tkinter as tkclass moreTab(tk.Tk):    def __init__(self):        Tk.__init__(self)        self.geometry("1200x600")        container = Frame(self, bg='#c9e3c1')        container.pack(side = "top", fill = 'both', expand = True)        container.grid_rowconfigure(0, weight = 1)        container.grid_columnconfigure(0, weight = 1)        self.frames = {}        for q in (pageone, widget):            frame = q(container,self)            self.frames[q] = frame            frame.place(x= 0,y = 0)        self.raise_frame(pageone)    def raise_frame(self,cont):        frame = self.frames[cont]        frame.tkraise()class widget(Frame):    def __init__(self, master, control):        Frame.__init__(self, master)        lab = tk.Label(self, text="main page")        lab.place(x = 10, y = 40)        but = tk.Button(self, text='visit start page', command=lambda: control.raise_frame(pageone))        but.place(x = 10, y = 70)class pageone(Frame):    def __init__(self, master, control):        Frame.__init__(self,master)        lab = Label(self, text = 'welcome to Game Analysis')        lab.place(x = 10, y = 10)        but = Button(self, text = "Start", command  = lambda: control.raise_frame(widget))        but.place(x = 10, y = 20)app = moreTab()app.mainloop()
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 196 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號