Home > Archive > PerlTk > February 2008 > Using WX in PTk environment?
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 |
Using WX in PTk environment?
|
|
|
| Hi Folks,
I was just looking at Wx for Perl. It has some Widgets. I was wondering
if it is possoble to use them in PTk enviornment. Since I have never used Wx
I was intreseted to see anyne can provide me with an answer/opinion.
Also, does any one know of a Wx newsgroup.
Rhanks,
-Sean
| |
| zentara 2008-02-20, 10:09 pm |
| On Wed, 20 Feb 2008 06:07:06 GMT, "Sean" <imfeaw5672@pacbell.net> wrote:
>Hi Folks,
>
>I was just looking at Wx for Perl. It has some Widgets. I was wondering
>if it is possoble to use them in PTk enviornment. Since I have never used Wx
>I was intreseted to see anyne can provide me with an answer/opinion.
>Also, does any one know of a Wx newsgroup.
>
>Rhanks,
>-Sean
You seem a little bit on how the various gui's work.
Usually, you don't mix them, i.e. you don't use Wx in a Perl/Tk script.
Each major gui has it's own event-loop system, and mixing them together
will lead to conflict in the respective event-loops.
That said, you CAN mix gui's, by letting one gui be the controlling
event loop, and the other a slave loop.
I don't have an Wx example handy, but here is a simple mix of Tk and
Gtk2. You can do it the other way too, just setup a timer in the master
eventloop to repeatedly update the other slave loop.
#!/usr/bin/perl -w
use strict;
use Gtk2;
use Tk;
my $mw = MainWindow->new(-title=>'Tk Window');
Gtk2->init;
my $window = Gtk2::Window->new('toplevel');
$window->set_title('Gtk2 Window');
my $glabel = Gtk2::Label->new("This is a Gtk2 Label");
$window->add($glabel);
$window->show_all;
my $tktimer = $mw->repeat(10, sub{
Gtk2->main_iteration while Gtk2->events_pending;
});
$mw->Button(-text=>' Quit ',
-command => sub{exit}
)->pack();
MainLoop;
########################################
__END__
zentara
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
|
|
|
|
|