tkinter - Screen Resolution

R

rahulnag22

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
 
R

rahulnag22

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
 
E

Eric Brunel

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
 
R

rahulnag22

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


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

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
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top