in reply to GUI for Test suite

So..Based on your description I do not see anything that could not be done at Tk(Perhaps your description is incomplete)
It may look like:
#!/usr/bin/perl -w use Tk; use Tk::DialogBox; use strict; my($main,$Edit); $main=MainWindow->new(-title => 'MyTestProg'); #Creating window with t +itle $main->Label(-text => 'Enter your action')->pack; $Edit=$main->Entry(-width => 20)->pack;#input field $main->Button(-text => 'Test', -command => \&process)->pack(-side => 'left'); #Button Calle +d 'Test' which calls the subroutine $main->Button(-text => 'Exit', -command => [$main => 'destroy'] #button for closing windwo )->pack; MainLoop;
Subroutine process can be just a regular sub.
The only difference is you must call smth like $request=$Edit->get to get data from input field
And if you want to print smth to user you can create another window and use smth like
... $InfoWindow->add("Label", -text => "Output: $output")->pack; ... $InfoWindow->Show(); $InfoWindow->destroy;
Here you can find everything you need about Tk http://www.ida.liu.se/~tompe/perltk/index.html

Replies are listed 'Best First'.
Re^2: GUI for Test suite
by dpatel (Novice) on Apr 19, 2010 at 07:32 UTC
    Ok. I got it. But can you tell me how I can generate multiple windows one by one according to user's choice? I tried looking at tutorial for Toplevel widget but I am still not sure how to use it. do you have any better sollution?

      Maybe you are missing some basic info about GUI programming:

      GUIs like Tk are working with "callbacks". That is, if the user clicks on some button (or menu item or...), a subroutine is called that you provided when you created the button. So when you program a GUI you have to think backwards. Not you as script writer control the sequence of events, it is the user.

      If you want user-generated windows, you have to create (for example) a button before you call MainLoop. And provide a callback subroutine with the code to create a new window. This subroutine is not called by your code, it is called by Tks MainLoop.

        I do have idea how it works. So I am confused. because I want to generate a main window which would be having few buttons to give users choice of actions to be performed. once user will choose the action, I want to put a dialog box for user asking further choices. so it should be like, once i get one answer, i should close that window and further a new window would be generated asking user for further choices, and so on.
      I'm not sure what you mean, but...for example you've created main window as in my prev post, with 2 buttons instead of input field (to make it simpler to explain)
      ... $main->Button(-text => 'Test', -command => \&Test)->pack(-side => 'left'); $main->Button(-text => 'Logging', -command => \&LogOutput)->pack(-side => 'left'); ... MainLoop; #Here Main window ends #And we declare our subs with own window for each sub test{ my $TestWindow; $TestWindow=$main->DialogBox(-title => 'Test sub window', -buttons => ["OK"]); #We've created dialog box for test sub output #Then folowing you testing code ... Testing code =) ... if($success){ $TestWindow->add("Label", -text => "Test passed!")->pack; } else { $TestWindow->add("Label", -text => "Test Failed!")->pack; } #Putting conditional output on our window $TestWindow->Show(); # Poping it in front main window #It is not separate window object, but dialog box produced #by main o +bject $InfoWindow->destroy; #Destroying it when OK pressed, and back to main + window }
      Same with logging sub..
        thanks man. Let me try this solution. I will get back to you if any further queries.