Tkinter Base Window

P

Peter Moscatt

Ok.... I am pretty new to Python (as you may have gathered from previous
posts). So now it time for another one of my ridiculous questions.... :)

When using 'Tkinter', what is used as the base window to work from, meaning
what widget do I use to place all other widgets onto to create a custom
dialog ?

Pete
 
C

Cameron Laird

Ok.... I am pretty new to Python (as you may have gathered from previous
posts). So now it time for another one of my ridiculous questions.... :)

When using 'Tkinter', what is used as the base window to work from, meaning
what widget do I use to place all other widgets onto to create a custom
dialog ?
.
.
.
When I use Tkinter, I don't talk that way.

I think in terms of the '.' root toplevel, into which I might pack
several frames:
import Tkinter

root = Tkinter.Tk()
frame1 = Tkinter.Frame(root, ...)
frame2 = Tkinter.Frame(root, ...)
important_button = Tkinter.Button(root, ...)
one_label = Tkinter.Label(frame1, ...)
... [and so on]
Is that what you're getting at?
 
S

Salvatore

Peter said:
Ok.... I am pretty new to Python (as you may have gathered from previous
posts). So now it time for another one of my ridiculous questions.... :)

When using 'Tkinter', what is used as the base window to work from, meaning
what widget do I use to place all other widgets onto to create a custom
dialog ?

Pete
Here you can find what you search and more ;-)
http://www.pythonware.com/library/tkinter/introduction/

Regards

Salvatore
 
S

smarter_than_you

Peter Moscatt said:
Ok.... I am pretty new to Python (as you may have gathered from previous
posts). So now it time for another one of my ridiculous questions.... :)

When using 'Tkinter', what is used as the base window to work from, meaning
what widget do I use to place all other widgets onto to create a custom
dialog ?

Pete

see http://www.pythonware.com/library/tkinter/introduction/hello-tkinter.htm

then click 'details' to see the explanation of root=Tk(), which
creates the root window in your native OS.

Note that you can create multiple root windows if you need them, and
have them appear at specific locations on the screen using the
..geometry method (this is dangerous though unless know what your
user's screen setup is)

-dbm
 
R

Russell E. Owen

Peter Moscatt said:
Ok.... I am pretty new to Python (as you may have gathered from previous
posts). So now it time for another one of my ridiculous questions.... :)

When using 'Tkinter', what is used as the base window to work from, meaning
what widget do I use to place all other widgets onto to create a custom
dialog ?

You'll want to create a new Toplevel (the term Tkinter uses for the
thing many of us think of as a window). If you want the window to be
modal you'll have to do a few extra things.

Tkinter already includes a lot of modules for creating dialogs. Find the
file Tkinter.py (in lib-tk in with your other python libraries) and look
at some of its fellows such as tkFileDialog.py, tkSimpleDialog.py and a
host of others with dialog in their names. Read the source code to see
how to use it (or import each package and type help(package_name)). You
may find exactly what you want, and if not, at least you'll see some
examples.

-- Russell
 

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
474,176
Messages
2,570,950
Members
47,500
Latest member
ArianneJsb

Latest Threads

Top