Questions tagged [perltk]

Perl's Tk module provides a complete interface to Tk, a GUI toolkit, while providing an object oriented interface to Perl code.

Tk is a graphical user interface toolkit for Perl.

95 questions
1
vote
1 answer

want to get the die error message from a command executed via open in Perl

I am trying to fork out a cmd like below my $h = IO::Handle->new; $self->{-handle} = $h; die "IO::Handle->new failed." unless defined $h; $self->{-pid} = open $h, $self->{-command} . ' 2>&1 |'; $self->fileevent($h, 'readable' => [\&_read_cmd_op,…
user180630
  • 11
  • 1
1
vote
1 answer

Binding the Return key not working

I am trying to bind my Enter button on my keyboard. I am writing in Perl Tk. I want one of the next to things to happen. When I hit "Enter" on my keyboard, I want a button within my program to operate. When I hit "Enter" on my keyboard, I want a…
Spartakus
  • 69
  • 1
  • 10
1
vote
2 answers

perl tk - how to keep GUI alive when procedure inside perl module is being executed

I have a perl tk routine calling a procedure from an imported perl module. The GUI hangs while the subroutine is being executed. Here is the code excerpt I am using. Can somebody please suggest a better way to do this so that the GUI is active while…
1
vote
1 answer

Tie an Optionmenu to an array in Perl TK

i need to automatically update an optionmenu in Perl Tk by tying an array to an Optionmenu if possible. To give an example, i can do this successfully with a listbox: tie @datafile, "Tk::Listbox", $lb; However, when I try doing the same for an…
Jesse Hernandez
  • 307
  • 2
  • 15
1
vote
1 answer

How to get the state of a key in Perl/Tk?

In Perl/Tk, it is possible to bind an event like this: $mw->bind('', sub{print "W is pressed";}); Is is possible to get this information the other direction? Can I make a call like "get the status of a key" or "check if W is…
capfan
  • 817
  • 10
  • 26
1
vote
1 answer

Perl get value of variable from while(1) loop when sub() change it

I got a small problem. When I create thread in main block of script, which should get the $txt value in while(1) loop, in the same time program create TopLevel window and there is a Text() object in $txt string. I want to read values from Text()…
Kamil Hajduk
  • 51
  • 1
  • 6
1
vote
1 answer

Perl (tk): how to run asynchronously a system command, being able to react to it's output?

I'm writing a wrapper to an external command ("sox", if this can help) with Perl "Tk". I need to run it asynchronously, of course, to avoid blocking tk's MainLoop(). But, I need to read it's output to notify user about command's progress. I am…
MarcoS
  • 17,323
  • 24
  • 96
  • 174
1
vote
1 answer

Unable to Remove Border from Tk Window

I am using Perl and Tk to display a window with images inside. It cycles through images in the pattern of white background, black background, image (1280x800), repeat. The problem is that I need to be able to view the entire image. Tk is putting on…
benny.bennett
  • 700
  • 1
  • 8
  • 25
1
vote
1 answer

PerlTk canvas + pixel manipulation

I'm having some problems understanding how the image types in PerlTk work. I basically want a way to create an "empty" image (for example fully white) and then manipulate the pixel data. I need to able to change a pixel to black or white. I've…
Ieyasu
  • 49
  • 5
1
vote
1 answer

Perltk - remembering the position in Text widget

I just wrote a very simple perl tk script to read a huge text file and display it with Text widget and attached it to Scrollbar widget. Now my problem is that each time i run the script , it displays from the first sentence ( of the whole text file…
dileepmani
  • 37
  • 8
0
votes
1 answer

Horizontal scrollbar not working

use Tk; my $mw=new MainWindow; $mw->geometry("1024x768"); $mw->Scrolled("Text", -scrollbars => "s", -width => 30,-height=>10)->pack( ); MainLoop; I need the help.The horizontal scrollbar is not working. What am I doing wrong?
amit
  • 85
  • 8
0
votes
1 answer

Perl HList: Change -background for individual items

I'm trying to alert the user that some data has been changed and needs to be saved. The data is displayed in Perl's Tk::HList box. I was hoping I could do: if ($new_item) { $HList->add($stock_no,-background=>"red"); } or even: if ($new_item) { …
charlesbridge
  • 1,172
  • 10
  • 21
0
votes
2 answers

Updating Tk label using Thread

use Thread; use warnings; use Tk; my $x = 10; my $mw = new MainWindow; $mw->Label(-text => 'honeywell')->place(-x => $x, -y => 50); my $thr = new Thread \&sub1; sub sub1 { for ($i = 0 ; $i < 20 ; $i++) { $x += 20; sleep(2); …
amit
  • 85
  • 8
0
votes
2 answers

Installing Perl/Tk on fedora

I am having trouble trying to install perl Tk on my system(fedora,perl v5.8.8).I downloaded the tarred module from http://search.cpan.org/~srezic/Tk-804.029/pod/gencmd, untarred it.In the terminal,I gave "perl Makefile.PL" which worked fine and then…
user976369
  • 1
  • 1
  • 1
0
votes
2 answers

Getting output on frame instead of terminal (Perl-Tk)

#!/usr/local/bin/perl use Tk; # Main Window $mw = new MainWindow; $label = $mw -> Label(-text=>"Hello folks") -> pack(); $button = $mw -> Button(-text => "Click here to Flush rules", -command =>\&flush) -> pack(); MainLoop; sub…
Chankey Pathak
  • 21,187
  • 12
  • 85
  • 133