Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #102132

Re: Tkinter spacing

From Peter Otten <__peter__@web.de>
Newsgroups comp.lang.python
Subject Re: Tkinter spacing
Date 2016-01-26 17:39 +0100
Organization None
Message-ID <mailman.20.1453826400.2338.python-list@python.org> (permalink)
References <e8736485-c4d6-4868-8da1-64ada4767bc1@googlegroups.com> <9ce727b5-db2d-41a1-ab51-e32f8ec614c8@googlegroups.com>

Show all headers | View raw


high5storage@gmail.com wrote:

>> from tkinter import *
>> from tkinter import ttk
>> 
>> root = Tk()
>> root.geometry("822x600+100+100")
>> nav_bar = ttk.Frame(root, borderwidth=2, relief='ridge', padding=(10, 3,
>> 10, 3))
>> 
>> btn_first  = ttk.Button(nav_bar, text='|<', width=4)  # for buttons
>> root.mainloop()
> 
> Hmm - this only gives me an empty window (no errors).

That's strange. 

If you ran the script in Idle, try again from the commandline.

> What puzzles me that every book/site on tkinter strongly warns of mixing
> pack and grid managers...

You can mix pack and grid for one window, but you have to pick one layout 
manager per parent widget:

top = Toplevel(root)

panel = Frame(top)
panel.pack(...) 
# we picked pack() and now have to use it for all
# children of top
canvas = Canvas(top, ...)
canvas.pack(...) # must use pack() again

# we are free to pick a layout for panel
ok = Button(panel)
ok.grid(...)
# we picked grid() and now have to use it for all 
# children of panel
cancel = Button(panel)
cancel.grid(...) # must use grid()

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Tkinter spacing KP <kai.peters@gmail.com> - 2016-01-25 19:41 -0800
  Re: Tkinter spacing Peter Otten <__peter__@web.de> - 2016-01-26 09:07 +0100
  Re: Tkinter spacing high5storage@gmail.com - 2016-01-26 07:55 -0800
    Re: Tkinter spacing Peter Otten <__peter__@web.de> - 2016-01-26 17:39 +0100
  Re: Tkinter spacing high5storage@gmail.com - 2016-01-26 14:48 -0800
    Re: Tkinter spacing Christian Gollwitzer <auriocus@gmx.de> - 2016-01-27 07:50 +0100
  Re: Tkinter spacing Christian Gollwitzer <auriocus@gmx.de> - 2016-01-27 07:48 +0100

csiph-web