For Programmers: Free Programming Magazines  


Home > Archive > Tcl > June 2006 > Is there any method to get the monitor's resolution?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Is there any method to get the monitor's resolution?
narcy

2006-06-26, 4:21 am

Is there any method to get the monitor's resolution?
such as
1024*768
1280*1024
?

Paul Whitfield

2006-06-26, 4:21 am

narcy wrote:
> Is there any method to get the monitor's resolution?
> such as
> 1024*768
> 1280*1024
> ?
>


wm maxsize . will return the
maximum size a top level window can be, which is smaller than the
monitors resolution.

But what you really want is

winfo screenheight .
winfo screenwidth .


BUT, that doesn't seem to work for dual monitors under
Windows XP (when I test I only get the resolution of the
primary monitor).

Hope that helps

Paul
Gerald W. Lester

2006-06-26, 4:21 am

narcy wrote:
> Is there any method to get the monitor's resolution?
> such as
> 1024*768
> 1280*1024


Read the man/help page on the winfo command of Tk. Pay particular attention
to the subcommands beginning with the string "screen".

NOTE -- some window managers have been known to lie.

--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
Ilya Ginzburg

2006-06-26, 4:21 am


"narcy" <jia.liu@ansys.com.cn> wrote in message
news:1151307827.699420.297310@m73g2000cwd.googlegroups.com...
> Is there any method to get the monitor's resolution?
> such as
> 1024*768
> 1280*1024
> ?
>


winfo screenwidth .
winfo screenheight .

Ilya


narcy

2006-06-26, 4:21 am


Ilya Ginzburg wrote:
> "narcy" <jia.liu@ansys.com.cn> wrote in message
> news:1151307827.699420.297310@m73g2000cwd.googlegroups.com...
>
> winfo screenwidth .
> winfo screenheight .
>
> Ilya


Thank you

Bruce Hartweg

2006-06-26, 7:07 pm

Paul Whitfield wrote:
> narcy wrote:
>
> wm maxsize . will return the
> maximum size a top level window can be, which is smaller than the
> monitors resolution.
>
> But what you really want is
>
> winfo screenheight .
> winfo screenwidth .
>
>
> BUT, that doesn't seem to work for dual monitors under
> Windows XP (when I test I only get the resolution of the
> primary monitor).
>


you should get the resolution of the screen that the "." window is on
the toplevel command takes a -screen option that can be used to bring
it up on a different monitor (I know this works nder X, not sure about
how windows really handle multiple monitors) - if it does work, it
then winfo screenheight $top should give the siZe of that one
(but as I said I don;t know if it works for windows or not)

Bruce
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com