How do I determine the maximum size of canvas that I can use within my Tcl/Tk
application?
For example, if the screen is 640x480, I want to create a canvas size of just
below this. However, if the screen is 800x600, I would wish the canvas to be
larger.
On an 800x600 screen, I tried:
% canvas .canv -width 800 -height 600
% pack .canv
The resultant window was larger than the screen due to the border, and the
frame went below the taskbar on my window manager ?
Is there a way that I can determine the number of pixels to reduce the canvas
by ?
The window was positioned in such a manner that its left hand edge was across
the screen and needed to be moved with the mouse.
Is there a way to force it into the top left corner ?
If I was creating a frame less than full size, I would probably want it to
begin centrally on the screen.
How can I do this ?
Can this be done purely within tcl or tk ?
I would like a generic solution that suits all platforms, if possible, as
opposed to using conditional branching based upon the platform type.
Thanks in advance to anyone who can help.
Regards,
Mark.
--
Mark Hobley
393 Quinton Road West
QUINTON
Birmingham
B32 1QE
Telephone: (0121) 247 1596
International: 0044 121 247 1596
Email: markhobley at hotpop dot donottypethisbit com
> I am new user of Tcl/Tk.
>
> How do I determine the maximum size of canvas that I can use within my
> Tcl/Tk application?
>
> For example, if the screen is 640x480, I want to create a canvas size of
> just below this. However, if the screen is 800x600, I would wish the
> canvas to be larger.
>
> On an 800x600 screen, I tried:
>
> % canvas .canv -width 800 -height 600
> % pack .canv
>
> The resultant window was larger than the screen due to the border, and the
> frame went below the taskbar on my window manager ?
>
> Is there a way that I can determine the number of pixels to reduce the
> canvas by ?
>
Look at the wm command.
"The wm command is used to interact with window managers in order to control
such things as the title for a window, its geometry, or the increments in
terms of which it may be resized."
wm maxsize
could be what you are looking for.
> The window was positioned in such a manner that its left hand edge was
> across the screen and needed to be moved with the mouse.
>
> Is there a way to force it into the top left corner ?
>
again, look for the wm command, something like
wm geometry $window 200x200+0+0
^^^^
> If I was creating a frame less than full size, I would probably want it to
> begin centrally on the screen.
>
> How can I do this ?
>
> Can this be done purely within tcl or tk ?
>
> I would like a generic solution that suits all platforms, if possible, as
> opposed to using conditional branching based upon the platform type.
>
> Thanks in advance to anyone who can help.
>
> Regards,
>
> Mark.
>
--
with best regards / mit freundlichen Grüßen
Heinz-Jürgen Oertel
+===================================================================
Merokok dapat menyebabkan kanker, serangan jantung,
impotensi dan gangguan kehamilan dan janin.
No, that not correct; please read the man page.
To get the screen size use the winfo command. There are commands to get
the screen width (winfo screenwidth) and height (winfo screenheight) as
well as other similar functions.
Agreed, but at least the SEE ALSO section points to it :-)
SEE ALSO
toplevel(n), winfo(n)
Regards
Heinz
> To get the screen size use the winfo command. There are commands to get
> the screen width (winfo screenwidth) and height (winfo screenheight) as
> well as other similar functions.
Yes -- also Tk doesn't update this coordinates ...
Using pivot software, such as ATI-Displays, to change the
orientation wont be reflected with screenwidth/height
winfo screenwidth . -> 1680
<rotate screen>
same width
-roger
As of Tk 8.4.8, Tk should respond to the Windows display changed
message and recache the screen info (like resolution and/or
screen size changes).
--
Jeff Hobbs, The Tcl Guy
http://www.ActiveState.com/, a division of Sophos