How can I change size of GUI?

M

Muddy Coder

Hi Folks,

I copied code from book:

class ScrolledText(Frame):
def __init__(self, parent=None, text='', file=None):
Frame.__init__(self, parent)
self.pack(expand=YES, fill=BOTH)
self.makeWidgets()
self.settext(text, file)
def makeWidgets(self):
sbar = Scrollbar(self)
text = Text(self, relief=SUNKEN, width=120)
sbar.config(command=text.yview)
text.config(yscrollcommand=sbar.set)
sbar.pack(side=RIGHT, fill=Y)
text.pack(side=LEFT, expand=YES, fill=BOTH)
self.text = text

It works, of course. But, the GUI is small, and I want to enlarge it.
I tried to add in options of width=120 for Text(), but it did not
work. Can somebody drop me a couple of lines for help? Thanks!

Muddy Coder
 
D

Dennis Lee Bieber

Hi Folks,

I copied code from book:

class ScrolledText(Frame):
def __init__(self, parent=None, text='', file=None):
Frame.__init__(self, parent)
self.pack(expand=YES, fill=BOTH)
self.makeWidgets()
self.settext(text, file)
def makeWidgets(self):
sbar = Scrollbar(self)
text = Text(self, relief=SUNKEN, width=120)
sbar.config(command=text.yview)
text.config(yscrollcommand=sbar.set)
sbar.pack(side=RIGHT, fill=Y)
text.pack(side=LEFT, expand=YES, fill=BOTH)
self.text = text

It works, of course. But, the GUI is small, and I want to enlarge it.
I tried to add in options of width=120 for Text(), but it did not
work. Can somebody drop me a couple of lines for help? Thanks!
Well, it would help if you identified the particular windowing
toolkit... Tkinter, wx, win32, ???

But offhand, I'd suggest that the problem could be that the parent
frame is what you need to resize -- everything else seems to be defined
to "expand" and "fill" the space held by the parent.
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
J

John Posner

For what definition of 'did not work'? Seems perfectly fine to me. Just try to
add the lines:

root = Tk()

Try adding a line like this:

root.geometry("400x300+100+75")

.... which means: "make the window 400 pixels wide and 300 pixels high,
with the upperleft corner at point (100,75)"
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top