第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

Tkinter:將小部件放置在框架中實(shí)際上是將其放置在根目錄中

Tkinter:將小部件放置在框架中實(shí)際上是將其放置在根目錄中

翻閱古今 2023-09-05 20:28:16
所以我在 Windows (python 3.8.5) 和 Linux (python 3.8.2) 上出現(xiàn)了一個(gè)獨(dú)特的問題。當(dāng)我將一個(gè)小部件放置在某個(gè)框架中時(shí),它實(shí)際上出于某種原因放置在根目錄中。我正在使用TkinterExtensions庫。我看過這個(gè)答案,但沒有幫助。無論我做什么,我都會遇到這個(gè)問題,但僅限于一幀。我現(xiàn)在懷疑這可能是 Tkinter 庫錯(cuò)誤。編輯:這似乎只發(fā)生在 python 3.8.x 中。我在另一臺 3.7.x 的電腦上嘗試過,它按預(yù)期工作。下面是一個(gè)非常通用的示例。from TkinterExtensions import *class Root(tk.Tk):    # sets up Tkinter and creates the other windows and places them accordingly.    def __init__(self):        super().__init__()        self.w1 = Window1(root=self).place(relx=0.0, rely=0.0, relheight=1.0, relwidth=1.0)        self.w2 = Window2(root=self).place(relx=0.0, rely=0.0, relheight=1.0, relwidth=1.0)        self.w3 = Window3(root=self).place(relx=0.0, rely=0.0, relheight=1.0, relwidth=1.0)                self.w1.hide()        self.w2.hide()        self.w3.hide()class Window1(TkinterFrame):    # ... anything needed for this frame    # This is the frame that's causing the issue.    # Despite the same code on all three windows,     # this one puts any widgets into root instead of as a child of this frame.        def __init__(self, root)        super().__init__(root)        self.button = TkinterButton(master=self, Text="button").place(relx=0.0, rely=0.0, relheight=1.0, relwidth=1.0)    class Window2(TkinterFrame):    # ... anything needed for this frame    # this frame works fine    class Window3(TkinterFrame):    # ... anything needed for this frame    # this frame works fine    如果需要,我可以使用更廣泛的通用代碼創(chuàng)建一個(gè)存儲庫。另外,我是TkinterExtensions庫的作者。
查看完整描述

1 回答

?
人到中年有點(diǎn)甜

TA貢獻(xiàn)1895條經(jīng)驗(yàn) 獲得超7個(gè)贊

在這個(gè)特定的框架中,我定義了len方法。一旦重命名,布局管理器以及放置在其中的任何小部件就會按預(yù)期工作。Tkinter.Frame 類沒有定義len所以我不知道為什么它會導(dǎo)致問題,但它確實(shí)發(fā)生了。



查看完整回答
反對 回復(fù) 2023-09-05
  • 1 回答
  • 0 關(guān)注
  • 104 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號