2013-06-03 2 views
0

최상위 창 내부에서 창을 열고 싶습니다. 그리고 그 창을 열 때까지 이전에 열었던 창으로 되돌릴 수 없어야합니다. 여기 내 코드입니다 :TopLevel 윈도우를 열고 창을 여는 방법

$mw = MainWindow->new; # This will make my main Window 
$mw->title("Main Window"); 
$menubar = $mw->Menu; 
$mw->configure(-menu => $menubar); 

$sub_window=$menubar->cascade(-label => 'Menu',-tearoff => 0); 
$sub_window->command(-label => 'Sub_Menu_Window',-command=>\&Open_window); # I've placed a sub menu which will open new window on main window. 

sub Open_window 
{ 
$mw=shift; 
$new_wind =$mw->Toplevel(-title => "New Sub Window"); 
$new_wind->grab; #here i have opened a new window and I won't be able to go back to my main window unless I will close this because of grab. 

$new_wind ->Button(-text=>"another_window",-command =>\&AnotherWindow) ->pack(); 

    sub AnotherWindow 
    { 
        # What Code Should I enter here to open a new window when I press button "another_window". ALso I want that until this window is closed I should not be able to work with other window previously opened.(Same as grab used with toplevel window) 
    } 

} 
MainLoop; 

내가 버튼과 그 창이 열린 상태로 유지됩니다 때까지를 누르면, 내가 다른 오픈 창 작동하지 않을 수 있도록, 최상위 창 등이 AnotherWindow이 같은 만들고 싶어.

답변

0

우리는 다음과 같이 수행 할 수 있습니다

sub AnotherWindow 
{ 
    $window_over_top_level =$new_wind->Toplevel(-title => "Window Over Top Level With Grab"); 
$window_over_top_level->geometry("270x380"); 
$window_over_top_level->grab; 
} 
관련 문제