Disable resize button

M

myonov

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()




def main():
app = App()
app.mainloop()

if __name__ == "__main__": main()
 
F

Francesco Bochicchio

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
 
M

myonov

Il Mon, 24 Mar 2008 04:38:50 -0700, myonov ha scritto:













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

Thanks a lot :)
Is there a way to avoid Tk() and to disable resize button only for an
instance of a class which inherits Frame?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top