Disable resize button
Francesco Bochicchio
bockman at virgilio.it
Mon Mar 24 11:45:42 EDT 2008
Il Mon, 24 Mar 2008 04:38:50 -0700, myonov ha scritto:
> Hi!
>
> I need to disable resize button in Tkinter. I inherit the Frame class.
> Then in the constructor i make my buttons, labels, etc. Then I pack them
> and when move borders of the frame everything changes it's location and
> it looks really bad. How can I change that?
> That's my code:
> # -*- coding: cp1251 -*-
> import Tkinter
>
> class App(Tkinter.Frame):
> def click(self):
> pass
>
> def click2(self):
> pass
>
> def __init__(self, master=None):
> Tkinter.Frame.__init__(self, master, width = 700, height =
> 400,\
> bg = "#999999")
> self.pack()
>
> # Buttons
>
> self.b1 = Tkinter.Button(self, text = u"Добави Книга",\
> command=self.click, font = "Courier",
> \
> fg = "red")
> self.b2 = Tkinter.Button(self, text = u"Добави читател",\
> command=self.click2, font = "Courier",
> \
> fg = "red")
> self.b1.place(relx = 0.75, rely = 0.3) self.b2.place(relx =
> 0.75, rely = 0.4)
>
> # Labels
>
> self.l1 = Tkinter.Label(self, font = "Courier", height = 4,\
> text = u"Информация", fg = "#ffffff",\
> bg = "#999999")
> self.l1.place(x = 275, y = 10)
>
> # Text Control
> # self.txt = Tkinter.Text(self, bg = "#124456", ) #
> self.txt.pack()
>
>
You could try including the frame in a toplevel window (e.g. passing
Tkinter.Tk() as super) and then doing super.wm_resizable(None, None)
A better idea would be using pack instead of place, leaving to the
toolkit the job of rearranging the widgets when the window is enlarged
or reduced.
Ciao
-----
FB
More information about the Python-list
mailing list