oip has asked for the wisdom of the Perl Monks concerning the following question:
can't find a solution for the following problem:
Can't call method "new_tk__text" without a package or object reference at test.pl line 50.
Could anyone help me?use strict; use Cwd; use warnings; use Tkx; Tkx::package_require('img::png'); my $main = Tkx::widget->new("."); my $title = "hello world"; my$version = "1.12"; $main->g_wm_title($title); # initialized window size (width x height) $main->g_wm_geometry("720x970"); #720x970 $main->g_wm_resizable( 1, 1 ); # resizable in x- and y-direction (x +,y) #my $img_icon = $main->Photo(-file=>'H:\daten\aktuelle Version!\Search +InLogfiles\img\logo_ux.png'); my $ux_logo_path = 'H:\daten\aktuelle Version!\SearchInLogfiles\img\lo +go_ux.ico'; Tkx::wm_iconbitmap($main, -default => "$ux_logo_path"); my $message_box_toplevel = $main->new___toplevel(); $message_box_toplevel->g_wm_title("Messages of $title"); # create message box in new window #my $message_box_toplevel = $main->Toplevel( -title => "Messages of $t +itle", ); # print $message_box_toplevel; #$message_box_toplevel->Icon(-image=>$img_icon); # disable closing message box -> message box will only be closed, if m +ain window will be closed $message_box_toplevel->g_wm_protocol( 'WM_DELETE_WINDOW', sub { return +; } ); # message box has two frames (top and bottom) my $f_message_top = $message_box_toplevel->new_frame()->g_pack( -side => 'top', -expand => 1, -fill => 'both', ); my $f_message_bottom = $message_box_toplevel->new_frame()->g_pack( -side => 'top', -expand => 0, -fill => 'both', ); # widgets of message box my $message_box = $f_message_top->new_tk__text( -wrap => 'none', -widt +h => 50, -height => 20 ); my $yscr_msg = $f_message_top->new_ttk__scrollbar( -command => [$messa +ge_box, 'yview'], -orient => 'vertical', ); my $xscr_msg = $f_message_top->new_ttk__scrollbar( -command => [$messa +ge_box, 'xview'], -orient => 'horizontal', ); my $message_button1 = $f_message_bottom->new_ttk__button( -text => ' S +ave ', -command => \&save_message_box ); my $message_button2 = $f_message_bottom->new_ttk__button( -text => ' S +ave As ... ', -command => \&save_as_message_box ); my $message_button3 = $f_message_bottom->new_ttk__button( -text => ' C +lear ', -command => \&clear_message_box ); $message_box->configure( -yscrollcommand => [ $yscr_msg, 'set' ] ); $message_box->configure( -xscrollcommand => [ $xscr_msg, 'set' ] ); #pack widgets of message box $yscr_msg->g_pack( -side => 'right', -expand => 0, -fill => 'y', ); $xscr_msg->g_pack( -side => 'bottom', -expand => 0, -fill => 'x', ); $message_box->g_pack( -side => 'left', -expand => 1, -fill => 'both', +); $message_button1->g_pack( -side => 'left' ); $message_button2->g_pack( -side => 'left' ); $message_button3->g_pack( -side => 'left' ); #redirect STDOUT and STDERR into message box tie *STDOUT, ref $message_box, $message_box; tie *STDERR, ref $message_box, $message_box; # some info for the user print "$title\n"; print "Version $version\n"; # MainLoop; # <STDIN>; # get date and print it to the message box my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = l +ocaltime(time); $year += 1900; $mon = $mon + 1; my $date = sprintf( "%02s.%02s.%04s-%02s:%02s:%02s ", $mday, $mon, $ye +ar, $hour, $min, $sec, ); print "$date\n"; print "---------------------------------------------\n\n"; Tkx::MainLoop();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: cant call method new_tk__text (why tkx)( Tkx without a package or object reference g_pack returns nothing)
by Anonymous Monk on Aug 12, 2013 at 10:12 UTC | |
|
Re: cant call method new_tk__text
by oip (Initiate) on Aug 13, 2013 at 08:06 UTC | |
by Anonymous Monk on Aug 13, 2013 at 08:13 UTC |