Python Forum
[Tkinter] not resize a frame - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: [Tkinter] not resize a frame (/thread-16769.html)



not resize a frame - Scorpio - Mar-13-2019

hi,

I define the size of a frame but when I add 4 buttons, it's automatically resized.

someone knows how I can fix it ?

thanks for your help


RE: not resize a frame - Yoriz - Mar-13-2019

No one can help with no code sample showing the issue you are having.


RE: not resize a frame - Scorpio - Mar-13-2019

it s there.

could you explain me why my frame is resize when my buttons are created?

if I run it without button, I obtain the right size.

class playmats(object):
    
    def __init__(self):
        self.contrée_window = Tk()
        self.contrée_window.geometry("800x800")
        self.contrée_playmats = ""



class contrée_playmats(playmats):
    
    def __init__(self):
        super().__init__()


    def build_playmats(self, list_players = ["nico", "franck", "steph", "man"]):
        self.contrée_playmats = Frame(width=800, height=800, bg="green")
        self.contrée_playmats.grid()
        
        self.entry_button()

        self.contrée_window.mainloop()
        self.contrée_window.destroy()


    def entry_button(self):
        list_place = ((2, 7), (7, 13), (13, 7), (7, 2))
        for seat in range(4):
            entry_button = Button(self.contrée_playmats, text="Take a seat")
            entry_button.grid(row=list_place[seat][0], column=list_place[seat][1], columnspan = 1, rowspan = 1)