View previous topic :: View next topic |
Author |
Message |
Mildew KWSN ArchBishop
Joined: 13 Oct 2002 Posts: 2617 Location: Sweden
|
Posted: Fri Aug 24, 2007 6:58 am Post subject: Perl/Tk |
|
|
Ok, so this hasn't got anything to do with distributed computing, but I'm sure at least one of you Ni!twits is a real Perl/Tk guru!
I want my script to ask the user for a textual input. I thought a good way to do this was by using a DialogBox widget and use something like this (basically stolen from the Perl/Tk manual):
Code: | $db = $mw->DialogBox(-title => 'Dis be da text entering box', -buttons['OK']);
$db->add('LabEntry', -textvariable => \$ze_text, -label => 'Enter your text here:', -labelPack => [-side => 'top'])->pack;
|
However, by default this only allows for one single line of text, and I want the user to be allowed to enter a lot more than that.
How can this be done???
Is there any way you can specify the number of lines in the textbox?
The only way a moron like myself can solve this task is by using a new Toplevel window that contains a frame in which you can enter text.
This makes the code look a bit weird since the code that draws the new window will not halt and wait for input. Instead you have to draw the new window and let that function complete, and then sort of "move" execution to the new window. |
|
Back to top |
|
|
JerWA Prince
Joined: 01 Jan 2007 Posts: 1497 Location: WA, USA
|
|
Back to top |
|
|
Mildew KWSN ArchBishop
Joined: 13 Oct 2002 Posts: 2617 Location: Sweden
|
Posted: Sat Aug 25, 2007 3:05 am Post subject: |
|
|
Ah, yes, the page shows an example of how to create a window with a textbox where you can put in text.
However, my problem here is that from the main program window I want to create a new popup window asking for information rather than to include a textbox in the original main window.
In the code of your main program you can open a Dialogbox widget, and the program will halt and wait for input, like a cin.getline statement in C will wait for keyboard input.
My problem is that the only Dialogbox that supports text in Perl/Tk that I have found only uses one line of text for the input.
I can create a new window that contains a text input like the one in the example page, but then that would not be a widget of type Dialogbox. If I from the main window program opens a new window that is NOT a Dialogbox, then the program will simply draw the new window and then continue with the next line of code, i.e. it will not stay and wait for input.
But thanks anyway! |
|
Back to top |
|
|
Grizzly Prince
Joined: 01 Jun 2002 Posts: 3136 Location: Creepy (Crawlley)
|
Posted: Sat Aug 25, 2007 3:58 am Post subject: |
|
|
Wots wrong with BASIC then ??
Gotta rest my brain cell now
Regds Grizz
PS - umm what was the question agin' _________________ Oh Bugger Forgot again - or is it Oh Father Reboot again ?
Ps Grizz in his second childhood - but not his last !
Edihtor of the KoKC (excused spel;l checher'er)
AND NI !!! Tophat 10e
[img]http://www.katrinashome.com/grizzly_counter.php[/[url=http://www.katrinashome.com/] ][/url] |
|
Back to top |
|
|
Mildew KWSN ArchBishop
Joined: 13 Oct 2002 Posts: 2617 Location: Sweden
|
Posted: Sat Aug 25, 2007 4:05 am Post subject: |
|
|
There's nothing wrong with BASIC. It was working great in the 80's and it's working great now!
Shouldn't uncle take his nap now?
|
|
Back to top |
|
|
Grizzly Prince
Joined: 01 Jun 2002 Posts: 3136 Location: Creepy (Crawlley)
|
Posted: Sun Aug 26, 2007 2:31 am Post subject: |
|
|
Mildew wrote: | There's nothing wrong with BASIC. It was working great in the 80's and it's working great now!
Shouldn't uncle take his nap now?
|
OK - Eon mode on now ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
Regds Grizz _________________ Oh Bugger Forgot again - or is it Oh Father Reboot again ?
Ps Grizz in his second childhood - but not his last !
Edihtor of the KoKC (excused spel;l checher'er)
AND NI !!! Tophat 10e
[img]http://www.katrinashome.com/grizzly_counter.php[/[url=http://www.katrinashome.com/] ][/url] |
|
Back to top |
|
|
|