Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Tk window location Win 7

by Marshall (Canon)
on Mar 09, 2020 at 22:14 UTC ( [id://11114051]=note: print w/replies, xml ) Need Help??


in reply to Tk window location Win 7

Please show some short example code of the problem. Without that, this is kind of like a "UFO report" - very hard to reproduce. It has been years since I did a complex Tk GUI, but it worked surprisingly well on XP,Win2K and Win7. I remember having to tweak a bit to get a nice display on all platforms, but I did succeed with the exception that there wasn't a nice "open directory" widget. I remember there being some issues with things like whether the user had "large fonts" enabled and interaction with custom display resolution. If you are using something aside from the defaults, please mention that.

Update: As I think about this, I haven't had the need to place a secondary window on the screen at particular x,y screen coordinates. If this window has to be at particular coordinates relative to the main window, why isn't it in the main window? Or why doesn't simple pack() work? The user can move these windows around and "save windows", meaning that you ask each window where it is and save those coordinates. Lot's of possibilities here.

Replies are listed 'Best First'.
Re^2: Tk window location Win 7
by Anonymous Monk on Mar 10, 2020 at 02:07 UTC
    Thank you for bothering to reply. The code below is just a bit of the definition of $G=$mw->DialogBox with most fields initially disabled. $G isn't displayed until requested by action in the main window.
    if(not defined $G) { $G = $mw->DialogBox(title => "List", -buttons => ["Edit/Save", "Add Picture", "Exit"], -default_button=>"Exit", -cancel_button=>'Exit', -command=>\&handle_display_button); # lots of code here my $img2 = $mv->Photo('resized'); $G->Label(-image=>'resized', -height=>400, -width=>600)->place(-x=>20, -y=>190); $lft= $G->Button(-image=>'left', -command=>[\&change_picture, 'down'], -relief=>'flat')->place(-x=>0, -y=>350); $rr = $Gems->Button(-image=>'right', -command=>[\&change_picture, 'up'], -relief=>'flat')->place(-x=>620, -y=>350); $scale = $G->Scale(-from=>0, -to=>$#Search_List, -variable=>\$sb_idx, -command=>\&Change_Record, -orient=>'horizontal', -length=>540)->place(-x=>50, -y=>600); # $G->positionfrom('program'); $G->geometry('650x680+0+0'); # $G->geometry('+0+0'); $G->minsize(650,680); $G->maxsize(650,680); } $G->Show;
    ->geometry('650x680); gave it the size I wanted, but it started opening half off screen so I added '+pos+pos', but it didn't change anything, no matter what values I used. Every time it is shown it is always in the same place and I have to move it manually to see it in its entirety.
      #!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11114006 use warnings; use Tk; use Tk::DialogBox; my $mw = MainWindow->new; $mw->geometry( '300x300+600+300' ); my $G = $mw->DialogBox( -popover => undef, -popanchor => 'nw', -overanchor => 'nw'); $G->minsize(650,680); $G->maxsize(650,680); $mw->Button(-text => 'Open Dialog Box', -command => sub { $G->Show }, )->pack; MainLoop;
        Thank you, that did the trick

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11114051]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-18 19:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found