I'm not familiar with POE, but from reading your post, it seems you want to create multiple Tk MainWindows. The MainWindow is associated with the Tk eventloop, so POE may be getting confused as to which Tk-eventloop it controls.. I would try creating 1 MainWindow, then create additional Tk windows as Toplevels instead of MainWindows. I just grabbed this POE-Tk file-tail code (by Jack D) to demonstrate. I added a Create Toplevel Button.
#!/usr/bin/perl use warnings; use strict; # Tk support is enabled if the Tk module is used before POE itself. use Tk; use Tk::ROText; use POE; use POE::Wheel::FollowTail; my $FILENAME = "z"; open (TAIL,">$FILENAME") or die; select(TAIL); my $ID; my $tl; POE::Session->create ( inline_states => { _start => \&ui_start, gotline => \&ui_read, ev_clear => \&ui_clear, writeline => \&ui_write, stopwrite => \&ui_stop, } ); $poe_kernel->run(); exit 0; sub ui_start { my ( $kernel, $session, $heap ) = @_[ KERNEL, SESSION, HEAP ]; $heap->{text_widget} = $poe_main_window->Scrolled('ROText',-scrollbars=>'ose' )->pack; $poe_main_window->Button ( -text => "Write to File", -command => $session->postback("writeline") )->pack; $poe_main_window->Button ( -text => "New Toplevel", -command => sub {my $tl = $poe_main_window->Toplevel(); $tl->geometry('300x100+100+100'); $tl->title( "Toplevel" ); } )->pack; $poe_main_window->Button ( -text => "Stop Writing to File", -command => $session->postback("stopwrite") )->pack; $poe_main_window->Button ( -text => "Clear Widget", -command => $session->postback("ev_clear") )->pack; $heap->{tail} = POE::Wheel::FollowTail->new ( Filename => $FILENAME, InputEvent => 'gotline'); } sub ui_read { $_[HEAP]->{text_widget}->insert('end',$_[ARG0]); $_[HEAP]->{text_widget}->insert('end',"\n"); $_[HEAP]->{text_widget}->see('end'); } sub ui_clear { $_[HEAP]->{text_widget}->delete('1.0','end'); } sub ui_write { $ID->cancel if ($ID); $|=1; $ID = $_[HEAP]->{text_widget}->repeat(1000,sub { print TAIL scalar gmtime,"\n"}); } sub ui_stop { return unless ($ID); $ID->cancel if ($ID); $ID = undef; $_[HEAP]->{text_widget}->insert('end',"Writing stopped....!!!!!\n\ +n"); } ######################################

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

In reply to Re: Creating new ptk windows with POE? by zentara
in thread Creating new ptk windows with POE? by cmv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.