2

フレーム内にグリッドがあるアプリがあり、 allgrid()と no の使用に問題がありpack()ます。
この問題を切り分けるために、アプリを簡素化しました。

それを使用pack()すると正しくサイズ変更されますが、grid()そうではありません。

私は何を間違っていますか?

以下に 2 つの例を示します。

  1. いくつかpack()

    from tkinter import *
    from tkinter import ttk
    
    class App(Frame):
        def __init__(self, parent):
            mframe = Frame.__init__(self, parent)
            self.pack(fill = 'both', expand = True)
            ttk.Sizegrip(mframe).pack(side = 'right')
    
            self.columnconfigure(0, weight = 1)
            self.rowconfigure(0, weight = 1)
    
            Text(self, width = 20, height = 2).grid(row = 0, column = 0, sticky = 'nsew')
    
    root = Tk()
    App(root)
    root.mainloop()
    
  2. のみgrid():

    from tkinter import *
    from tkinter import ttk
    
    class App(Frame):
        def __init__(self, parent):
            mframe = Frame.__init__(self, parent)
            self.grid(row = 0, column = 0, sticky = 'nsew')
            ttk.Sizegrip(root).grid(row = 1, sticky = 'se')
    
            self.columnconfigure(0, weight = 1)
            self.rowconfigure(0, weight = 1)
    
            Text(self, width = 20, height = 2).grid(row = 0, column = 0, sticky = 'nsew')
    
    root = Tk()
    App(root)
    root.mainloop()
    

.

4

1 に答える 1