New to Tkinter GUI building

Adonis Vargas adonis at REMOVETHISearthlink.net
Thu Mar 1 12:20:20 EST 2007


Adam wrote:
> On Feb 28, 9:13 pm, Adonis Vargas <ado... at REMOVETHISearthlink.net>
> wrote:
>> Adam wrote:
>>
>> <snip>
>>
>>> I think my main questions are:
>>> 1. How can I get the Window to be sized the way I want it?
>>> 2. How can I get the Scrollbars to fill the side of the text box
>>> instead of being small? (like .pack(fill= tk.Y)
>> <snip>
>>
>>> I have only posted the code relevant to the GUI.
>>> TIA
>>> Adam
>> To size the window use Tk's geometry method
>>
>>      self.top.geometry("%dx%d%+d%+d" % (800, 600, 0, 0)) # (width,
>> height, x, y)
>>
>> For the scrollbar to fill vertically, use the sticky grid option.
>>
>>      self.scrlr1.grid(row=0, column=1, sticky=tk.N + tk.S)
>>
>> Hope this helps.
>>
>> Adonis
> 
> Can't test now as its late in th UK and I'm going to bed. Looks good
> though.
> So remove the size from the frames etc and use the geometry method
> instead? Then use grid to "pack" them for want of a better word?
> 

No, the geometry method is used to set the size of your main application 
window. This is what I understood from your first question, and please 
correct me if I am wrong. The grid method (or the pack method) are used 
to layout the widgets.

In other words, after line 8 of the code you provided you would add this 
line:

     self.top.geometry("%dx%d%+d%+d" % (800, 600, 0, 0))

Hope this helps.

Adonis



More information about the Python-list mailing list