Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Setting Window Size using Pack Under Tkinter

Reply
Thread Tools

Setting Window Size using Pack Under Tkinter

 
 
Fuzzyman
Guest
Posts: n/a
 
      01-16-2004
I'm having trouble implementing my GUI using Tkinter......
I've been working through the Tkinter tutorials from 'Programming
Python' and am generally happy enough with the functionality and feel
of the results *but* - I can't see how to set the size of the root
window (or any top level window) and to stop it being resized........

Thanks for any help.

Fuzzyman


--

YAPLP
Yet Another Python Links Page
http://www.voidspace.org.uk/coollink...on_links.shtml

Python Utils
http://www.voidspace.org.uk/atlantib...thonutils.html

--

http://www.Voidspace.org.uk
The Place where headspace meets cyberspace. Online resource site -
covering science, technology, computing, cyberpunk, psychology,
spirituality, fiction and more.

---
http://www.atlantibots.org.uk
http://groups.yahoo.com/group/atlantis_talk/
Atlantibots - stomping across the worlds of Atlantis.
---
http://www.fuchsiashockz.co.uk
http://groups.yahoo.com/group/void-shockz
---

Everyone has talent. What is rare is the courage to follow talent
to the dark place where it leads. -Erica Jong
Ambition is a poor excuse for not having sense enough to be lazy.
-Milan Kundera
 
Reply With Quote
 
 
 
 
duikboot
Guest
Posts: n/a
 
      01-16-2004
from Tkinter import *
gui=Tk()

####code####
gui.geometry("+%d+%d" %(300, 100))
gui.resizable(0,0)

if __name__=='__main__':
gui.mainloop()




"Fuzzyman" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed) om...
> I'm having trouble implementing my GUI using Tkinter......
> I've been working through the Tkinter tutorials from 'Programming
> Python' and am generally happy enough with the functionality and feel
> of the results *but* - I can't see how to set the size of the root
> window (or any top level window) and to stop it being resized........
>
> Thanks for any help.
>
> Fuzzyman
>
>
> --
>
> YAPLP
> Yet Another Python Links Page
> http://www.voidspace.org.uk/coollink...on_links.shtml
>
> Python Utils
> http://www.voidspace.org.uk/atlantib...thonutils.html
>
> --
>
> http://www.Voidspace.org.uk
> The Place where headspace meets cyberspace. Online resource site -
> covering science, technology, computing, cyberpunk, psychology,
> spirituality, fiction and more.
>
> ---
> http://www.atlantibots.org.uk
> http://groups.yahoo.com/group/atlantis_talk/
> Atlantibots - stomping across the worlds of Atlantis.
> ---
> http://www.fuchsiashockz.co.uk
> http://groups.yahoo.com/group/void-shockz
> ---
>
> Everyone has talent. What is rare is the courage to follow talent
> to the dark place where it leads. -Erica Jong
> Ambition is a poor excuse for not having sense enough to be lazy.
> -Milan Kundera



 
Reply With Quote
 
 
 
 
duikboot
Guest
Posts: n/a
 
      01-16-2004
from Tkinter import *
gui=Tk()

####code####
gui.geometry("+%d+%d" %(300, 100))
gui.resizable(0,0)
gui.mainloop()

Will work offcourse too..

cheers,

Arjen



"duikboot" <(E-Mail Removed)> schreef in bericht
news:4007de09$0$151$(E-Mail Removed)4all. nl...
> from Tkinter import *
> gui=Tk()
>
> ####code####
> gui.geometry("+%d+%d" %(300, 100))
> gui.resizable(0,0)
>
> if __name__=='__main__':
> gui.mainloop()
>
>
>
>
> "Fuzzyman" <(E-Mail Removed)> schreef in bericht
> news:(E-Mail Removed) om...
> > I'm having trouble implementing my GUI using Tkinter......
> > I've been working through the Tkinter tutorials from 'Programming
> > Python' and am generally happy enough with the functionality and feel
> > of the results *but* - I can't see how to set the size of the root
> > window (or any top level window) and to stop it being resized........
> >
> > Thanks for any help.
> >
> > Fuzzyman
> >
> >
> > --
> >
> > YAPLP
> > Yet Another Python Links Page
> > http://www.voidspace.org.uk/coollink...on_links.shtml
> >
> > Python Utils
> > http://www.voidspace.org.uk/atlantib...thonutils.html
> >
> > --
> >
> > http://www.Voidspace.org.uk
> > The Place where headspace meets cyberspace. Online resource site -
> > covering science, technology, computing, cyberpunk, psychology,
> > spirituality, fiction and more.
> >
> > ---
> > http://www.atlantibots.org.uk
> > http://groups.yahoo.com/group/atlantis_talk/
> > Atlantibots - stomping across the worlds of Atlantis.
> > ---
> > http://www.fuchsiashockz.co.uk
> > http://groups.yahoo.com/group/void-shockz
> > ---
> >
> > Everyone has talent. What is rare is the courage to follow talent
> > to the dark place where it leads. -Erica Jong
> > Ambition is a poor excuse for not having sense enough to be lazy.
> > -Milan Kundera

>
>



 
Reply With Quote
 
Fuzzyman
Guest
Posts: n/a
 
      01-19-2004
Short of actually trying it...... (when I get home I *will* try it)

Would the following work :

from Tkinter import *
gui=Tk()
Button(gui, text='A button', command=a_function).pack()

####code####
gui.geometry("+%d+%d" %(300, 100))
gui.resizable(0,0)
gui.mainloop()

??

If I recall correctly it ought to.... (mixing the pack and geometry
methods in the same GUI)...

Anyway - thanks.

Fuzzy


"duikboot" <(E-Mail Removed)> wrote in message news:<4007dedc$0$166$(E-Mail Removed)4all .nl>...
> from Tkinter import *
> gui=Tk()
>
> ####code####
> gui.geometry("+%d+%d" %(300, 100))
> gui.resizable(0,0)
> gui.mainloop()
>
> Will work offcourse too..
>
> cheers,
>
> Arjen
>
>
>
> "duikboot" <(E-Mail Removed)> schreef in bericht
> news:4007de09$0$151$(E-Mail Removed)4all. nl...
> > from Tkinter import *
> > gui=Tk()
> >
> > ####code####
> > gui.geometry("+%d+%d" %(300, 100))
> > gui.resizable(0,0)
> >
> > if __name__=='__main__':
> > gui.mainloop()
> >
> >
> >
> >
> > "Fuzzyman" <(E-Mail Removed)> schreef in bericht
> > news:(E-Mail Removed) om...
> > > I'm having trouble implementing my GUI using Tkinter......
> > > I've been working through the Tkinter tutorials from 'Programming
> > > Python' and am generally happy enough with the functionality and feel
> > > of the results *but* - I can't see how to set the size of the root
> > > window (or any top level window) and to stop it being resized........
> > >
> > > Thanks for any help.
> > >
> > > Fuzzyman
> > >
> > >
> > > --
> > >
> > > YAPLP
> > > Yet Another Python Links Page
> > > http://www.voidspace.org.uk/coollink...on_links.shtml
> > >
> > > Python Utils
> > > http://www.voidspace.org.uk/atlantib...thonutils.html
> > >
> > > --
> > >
> > > http://www.Voidspace.org.uk
> > > The Place where headspace meets cyberspace. Online resource site -
> > > covering science, technology, computing, cyberpunk, psychology,
> > > spirituality, fiction and more.
> > >
> > > ---
> > > http://www.atlantibots.org.uk
> > > http://groups.yahoo.com/group/atlantis_talk/
> > > Atlantibots - stomping across the worlds of Atlantis.
> > > ---
> > > http://www.fuchsiashockz.co.uk
> > > http://groups.yahoo.com/group/void-shockz
> > > ---
> > >
> > > Everyone has talent. What is rare is the courage to follow talent
> > > to the dark place where it leads. -Erica Jong
> > > Ambition is a poor excuse for not having sense enough to be lazy.
> > > -Milan Kundera

> >
> >

 
Reply With Quote
 
Eric Brunel
Guest
Posts: n/a
 
      01-19-2004
Fuzzyman wrote:
> Short of actually trying it...... (when I get home I *will* try it)
>
> Would the following work :
>
> from Tkinter import *
> gui=Tk()
> Button(gui, text='A button', command=a_function).pack()
>
> ####code####
> gui.geometry("+%d+%d" %(300, 100))
> gui.resizable(0,0)
> gui.mainloop()
>
> ??


Yes it will. Note however that doing gui.geometry("+300+100") will actually move
the window, not resize it. To resize the window, use gui.geometry("300x100")

More generally, the syntax for the geometry is "WxH+X+Y" where W and H are the
window's width and height resp. and X & Y the coordinates of its top-left corner
from the top-left corner of the screen.

> If I recall correctly it ought to.... (mixing the pack and geometry
> methods in the same GUI)...
>
> Anyway - thanks.
>
> Fuzzy
>
>
> "duikboot" <(E-Mail Removed)> wrote in message news:<4007dedc$0$166$(E-Mail Removed)4all .nl>...
>
>>from Tkinter import *
>> gui=Tk()
>>
>> ####code####
>> gui.geometry("+%d+%d" %(300, 100))
>> gui.resizable(0,0)
>> gui.mainloop()
>>
>>Will work offcourse too..
>>
>>cheers,
>>
>>Arjen
>>
>>
>>
>>"duikboot" <(E-Mail Removed)> schreef in bericht
>>news:4007de09$0$151$(E-Mail Removed)4al l.nl...
>>
>>>from Tkinter import *
>>>gui=Tk()
>>>
>>>####code####
>>>gui.geometry("+%d+%d" %(300, 100))
>>>gui.resizable(0,0)
>>>
>>>if __name__=='__main__':
>>> gui.mainloop()
>>>
>>>
>>>
>>>
>>>"Fuzzyman" <(E-Mail Removed)> schreef in bericht
>>>news:(E-Mail Removed) e.com...
>>>
>>>>I'm having trouble implementing my GUI using Tkinter......
>>>>I've been working through the Tkinter tutorials from 'Programming
>>>>Python' and am generally happy enough with the functionality and feel
>>>>of the results *but* - I can't see how to set the size of the root
>>>>window (or any top level window) and to stop it being resized........
>>>>
>>>>Thanks for any help.
>>>>
>>>>Fuzzyman
>>>>
>>>>
>>>>--
>>>>
>>>>YAPLP
>>>>Yet Another Python Links Page
>>>>http://www.voidspace.org.uk/coollink...on_links.shtml
>>>>
>>>>Python Utils
>>>>http://www.voidspace.org.uk/atlantib...thonutils.html
>>>>
>>>>--
>>>>
>>>>http://www.Voidspace.org.uk
>>>>The Place where headspace meets cyberspace. Online resource site -
>>>>covering science, technology, computing, cyberpunk, psychology,
>>>>spirituality, fiction and more.
>>>>
>>>>---
>>>>http://www.atlantibots.org.uk
>>>>http://groups.yahoo.com/group/atlantis_talk/
>>>>Atlantibots - stomping across the worlds of Atlantis.
>>>>---
>>>>http://www.fuchsiashockz.co.uk
>>>>http://groups.yahoo.com/group/void-shockz
>>>>---
>>>>
>>>>Everyone has talent. What is rare is the courage to follow talent
>>>>to the dark place where it leads. -Erica Jong
>>>>Ambition is a poor excuse for not having sense enough to be lazy.
>>>> -Milan Kundera
>>>
>>>



--
- Eric Brunel <eric dot brunel at pragmadev dot com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting picture size/setting window size jodleren Javascript 2 02-15-2007 12:35 PM
opening new window in one window using Tkinter -- Help please Clara Python 6 04-25-2005 03:09 AM
Pack parent control in child using control.pack(in_= syntax? Tim Jones Python 0 01-31-2004 10:22 PM
Setting applet window size using javascript? Put 030516 in email subj to get thru Javascript 2 10-25-2003 02:24 PM
Poor Mans NIMH Battery Pack and SLA Battery Pack ajacobs2 Digital Photography 0 08-19-2003 12:42 PM



Advertisments