By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,534 Members | 1,830 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,534 IT Pros & Developers. It's quick & easy.

Setting Window Size using Pack Under Tkinter

P: n/a
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
Jul 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
from Tkinter import *
gui=Tk()

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

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


"Fuzzyman" <mi*****@foord.net> schreef in bericht
news:80**************************@posting.google.c 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

Jul 18 '05 #2

P: n/a
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" <ar******************@hccnet.nl> schreef in bericht
news:40*********************@dreader5.news.xs4all. nl...
from Tkinter import *
gui=Tk()

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

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


"Fuzzyman" <mi*****@foord.net> schreef in bericht
news:80**************************@posting.google.c 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


Jul 18 '05 #3

P: n/a
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" <ar******************@hccnet.nl> wrote in message news:<40*********************@dreader5.news.xs4all .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" <ar******************@hccnet.nl> schreef in bericht
news:40*********************@dreader5.news.xs4all. nl...
from Tkinter import *
gui=Tk()

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

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


"Fuzzyman" <mi*****@foord.net> schreef in bericht
news:80**************************@posting.google.c 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


Jul 18 '05 #4

P: n/a
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" <ar******************@hccnet.nl> wrote in message news:<40*********************@dreader5.news.xs4all .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" <ar******************@hccnet.nl> schreef in bericht
news:40*********************@dreader5.news.xs4al l.nl...
from Tkinter import *
gui=Tk()

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

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


"Fuzzyman" <mi*****@foord.net> schreef in bericht
news:80**************************@posting.googl 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

Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.