468,244 Members | 1,793 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,244 developers. It's quick & easy.

tkinter - Screen Resolution

Hi,
I have developed a GUI using tkinter (grid geometory manager).
The structure is a top frame containing multiple subframes. Each
subframe has a combination of widgets like(Entry, label,
button,listboxes). The subframes are placed with a padx and pady
offset with regards to the other subframes. And the widgets within
these subframes have their own padx and pady offsets. The GUI runs
fine on my linux box, but on a different linux box things get wierd.
I see things like-
1) The frame width increasing
2) The widget padx translating to much bigger offsets with reference
to the subframe edges
3) Widget widths like that for Entry become bigger

I Know its to do with the screen resolution settings and user settings
on different machines. Can anyone point me in the right
direction(before I start looking into it)as how to account for
different screen resolutions so as to have as uniform a GUI look as
possible across different user machines.
A smaller version of my GUI layout looks something like-->

===============Top Frame=================
= - SubFrame - ---------SubFrame---------
= - - -
'''''''''''''''''''''''''''''''''
-
= - - - ' Widget ' -
= - - -
''''''''''''''''''''''''''''''''' -
= - Widget - -----------------------------
= -
-
= - - ---------SubFrame---------
= - - -
-
= - - -
'''''''''''''''''''''''''''''''''
-
= - Widget - - ' Widget ' -
= - - -
''''''''''''''''''''''''''''''''' -
= - - -
-
= - - -
'''''''''''''''''''''''''''''''''
-
= - - - ' Widget ' -
= - Widget - - '''''''''''''''''''''''''''''''''
-
= --------------- -----------------------------
=========================================
Thanks
Rahul

May 9 '07 #1
3 5998
On May 9, 10:37 am, rahulna...@yahoo.com wrote:
Hi,
I have developed a GUI using tkinter (grid geometory manager).
The structure is a top frame containing multiple subframes. Each
subframe has a combination of widgets like(Entry, label,
button,listboxes). The subframes are placed with a padx and pady
offset with regards to the other subframes. And the widgets within
these subframes have their own padx and pady offsets. The GUI runs
fine on my linux box, but on a different linux box things get wierd.
I see things like-
1) The frame width increasing
2) The widget padx translating to much bigger offsets with reference
to the subframe edges
3) Widget widths like that for Entry become bigger

I Know its to do with the screen resolution settings and user settings
on different machines. Can anyone point me in the right
direction(before I start looking into it)as how to account for
different screen resolutions so as to have as uniform a GUI look as
possible across different user machines.
A smaller version of my GUI layout looks something like-->

===============Top Frame=================
= - SubFrame - ---------SubFrame---------
= - - - ''''''''''''''''''''''''''''''''' -
= - - - ' Widget ' -
= - - - ''''''''''''''''''''''''''''''''' -
= - Widget - -----------------------------
= - -
= - - ---------SubFrame---------
= - - - -
= - - - ''''''''''''''''''''''''''''''''' -
= - Widget - - ' Widget ' -
= - - - ''''''''''''''''''''''''''''''''' -
= - - - -
= - - - ''''''''''''''''''''''''''''''''' -
= - - - ' Widget ' -
= - Widget - - ''''''''''''''''''''''''''''''''' -
= --------------- -----------------------------
=========================================

Thanks
Rahul

May 9 '07 #2
On Wed, 09 May 2007 18:37:32 +0200, <ra********@yahoo.comwrote:
Hi,
I have developed a GUI using tkinter (grid geometory manager).
The structure is a top frame containing multiple subframes. Each
subframe has a combination of widgets like(Entry, label,
button,listboxes). The subframes are placed with a padx and pady
offset with regards to the other subframes. And the widgets within
these subframes have their own padx and pady offsets. The GUI runs
fine on my linux box, but on a different linux box things get wierd.
I see things like-
1) The frame width increasing
2) The widget padx translating to much bigger offsets with reference
to the subframe edges
3) Widget widths like that for Entry become bigger

I Know its to do with the screen resolution settings and user settings
on different machines. Can anyone point me in the right
direction(before I start looking into it)as how to account for
different screen resolutions so as to have as uniform a GUI look as
possible across different user machines.
[snip]

For some reason, tk uses different default units for coordinates and font
sizes: a coordinate specified as just a number is considered to be in
pixels (a.k.a screen points); a font size specified as just a number is
considered to be in points, i.e 1/72 inch. So these units are the same
only if your screen resolution is exactly 72 dpi, which is usually not the
case.

If this is actually your problem, the way to correct it is quite simple:
the tk command "tk scaling 1" tells tk that a point and a pixel are the
same thing. To issue it, you may have to use explicitely the tcl
interpreter used by Tkinter by doing:
aWidget.tk.call('tk', 'scaling', 1)
where aWidget is any Tkinter widget. This is what I had to do with Python
2.1; it may be easier with later Python/Tkinter versions.

HTH
--
python -c "print ''.join([chr(154 - ord(c)) for c in
'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"
May 10 '07 #3
On May 10, 1:29 am, "Eric Brunel" <eric.bru...@pragmadev.comwrote:
On Wed, 09 May 2007 18:37:32 +0200, <rahulna...@yahoo.comwrote:
Hi,
I have developed a GUI usingtkinter(grid geometory manager).
The structure is a top frame containing multiple subframes. Each
subframe has a combination of widgets like(Entry, label,
button,listboxes). The subframes are placed with a padx and pady
offset with regards to the other subframes. And the widgets within
these subframes have their own padx and pady offsets. The GUI runs
fine on my linux box, but on a different linux box things get wierd.
I see things like-
1) The frame width increasing
2) The widget padx translating to much bigger offsets with reference
to the subframe edges
3) Widget widths like that for Entry become bigger
I Know its to do with the screen resolution settings and user settings
on different machines. Can anyone point me in the right
direction(before I start looking into it)as how to account for
different screen resolutions so as to have as uniform a GUI look as
possible across different user machines.

[snip]

For some reason, tk uses different default units for coordinates and font
sizes: a coordinate specified as just a number is considered to be in
pixels (a.k.a screen points); a font size specified as just a number is
considered to be in points, i.e 1/72 inch. So these units are the same
only if your screen resolution is exactly 72 dpi, which is usually not the
case.

If this is actually your problem, the way to correct it is quite simple:
the tk command "tk scaling 1" tells tk that a point and a pixel are the
same thing. To issue it, you may have to use explicitely the tcl
interpreter used byTkinterby doing:
aWidget.tk.call('tk', 'scaling', 1)
where aWidget is anyTkinterwidget. This is what I had to do with Python
2.1; it may be easier with later Python/Tkinterversions.

HTH
--
python -c "print ''.join([chr(154 - ord(c)) for c in
'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"

This is just what I watned...Thanks that works great -Rahul

May 10 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by ZaGras | last post: by
5 posts views Thread by Chris | last post: by
5 posts views Thread by Maxi | last post: by
9 posts views Thread by Steve Wright | last post: by
3 posts views Thread by Thomas Morton | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.