Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102663 > unrolled thread
| Started by | jenswaelkens@gmail.com |
|---|---|
| First post | 2016-02-08 04:15 -0800 |
| Last post | 2016-02-08 16:11 +0100 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.lang.python
[newbie] problem with geometry setting in Tkinter jenswaelkens@gmail.com - 2016-02-08 04:15 -0800
Re: [newbie] problem with geometry setting in Tkinter Peter Otten <__peter__@web.de> - 2016-02-08 13:26 +0100
Re: [newbie] problem with geometry setting in Tkinter jenswaelkens@gmail.com - 2016-02-08 06:34 -0800
Re: [newbie] problem with geometry setting in Tkinter Christian Gollwitzer <auriocus@gmx.de> - 2016-02-08 16:11 +0100
| From | jenswaelkens@gmail.com |
|---|---|
| Date | 2016-02-08 04:15 -0800 |
| Subject | [newbie] problem with geometry setting in Tkinter |
| Message-ID | <31e9b382-bc20-4283-b17c-23a97c8b6083@googlegroups.com> |
I'm trying to set the geometry of my top window, but the size is
unaffected.
This is the code:
#!/usr/bin/env python
import Tkinter
top=Tkinter.Tk()
top.geometry=('900x460')
top.update_idletasks()
print (top.winfo_width())
print (top.winfo_height())
print (top.winfo_geometry())
top.mainloop()
and this is the result when running the code:
200
200
200x200+1+584
Can anyone here tell me what I am doing wrong and how to change it?
Thanks
Jens
[toc] | [next] | [standalone]
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Date | 2016-02-08 13:26 +0100 |
| Message-ID | <mailman.93.1454934401.2317.python-list@python.org> |
| In reply to | #102663 |
jenswaelkens@gmail.com wrote:
> I'm trying to set the geometry of my top window, but the size is
> unaffected.
> This is the code:
>
> #!/usr/bin/env python
> import Tkinter
> top=Tkinter.Tk()
> top.geometry=('900x460')
That's an assignment, but geometry() is a method that you have to invoke:
top.geometry('900x460')
> top.update_idletasks()
> print (top.winfo_width())
> print (top.winfo_height())
> print (top.winfo_geometry())
> top.mainloop()
>
> and this is the result when running the code:
> 200
> 200
> 200x200+1+584
>
>
> Can anyone here tell me what I am doing wrong and how to change it?
> Thanks
>
> Jens
[toc] | [prev] | [next] | [standalone]
| From | jenswaelkens@gmail.com |
|---|---|
| Date | 2016-02-08 06:34 -0800 |
| Message-ID | <2c0abe95-fbea-4818-bf8d-0bb1261cf8b8@googlegroups.com> |
| In reply to | #102666 |
Op maandag 8 februari 2016 13:26:56 UTC+1 schreef Peter Otten:
> jenswaelkens@gmail.com wrote:
>
> > I'm trying to set the geometry of my top window, but the size is
> > unaffected.
> > This is the code:
> >
> > #!/usr/bin/env python
> > import Tkinter
> > top=Tkinter.Tk()
> > top.geometry=('900x460')
>
> That's an assignment, but geometry() is a method that you have to invoke:
>
> top.geometry('900x460')
>
> > top.update_idletasks()
> > print (top.winfo_width())
> > print (top.winfo_height())
> > print (top.winfo_geometry())
> > top.mainloop()
> >
> > and this is the result when running the code:
> > 200
> > 200
> > 200x200+1+584
> >
> >
> > Can anyone here tell me what I am doing wrong and how to change it?
> > Thanks
> >
> > Jens
thanks a lot for helping me out
kind regards,
Jens
[toc] | [prev] | [next] | [standalone]
| From | Christian Gollwitzer <auriocus@gmx.de> |
|---|---|
| Date | 2016-02-08 16:11 +0100 |
| Message-ID | <n9ab29$1v3$1@dont-email.me> |
| In reply to | #102671 |
Am 08.02.16 um 15:34 schrieb jenswaelkens@gmail.com:
> Op maandag 8 februari 2016 13:26:56 UTC+1 schreef Peter Otten:
>> jenswaelkens@gmail.com wrote:
>>
>>> I'm trying to set the geometry of my top window, but the size is
>>> unaffected.
>>> This is the code:
>>
>> top.geometry('900x460')
>>
>
> thanks a lot for helping me out
The answer is correct, however I think that in general it is wrong to
set the geometry like this. grid and pack compute the necessary space
for the window themselves, which adapts to the length of labels on
buttons etc. In all GUI programs I've written, the only place to set
window sizes in pixels have been canvas widgets, which do not have a
native size derived from the content. Setting the size on the toplevel,
and in absolute numbers, i.e. not computed from other sizes, is likely
to lead to problems on different platforms, font sizes or theme changes.
Christian
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web