Home > Archive > PerlTk > January 2007 > Delete all Widgets
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 |
Delete all Widgets
|
|
| Cheater 2007-01-06, 7:14 pm |
| How would I go about deleting all widgets in the window? Is there some
clearAll command? Or would I need to delete each widget individually
using a loop (how would you do that?)?
| |
| Marc Dashevsky 2007-01-06, 7:14 pm |
| In article <1167794050.824979.269540@s34g2000cwa.googlegroups.com>, MrCheatr@gmail.com
says...
> How would I go about deleting all widgets in the window? Is there some
> clearAll command? Or would I need to delete each widget individually
> using a loop (how would you do that?)?
foreach ($parent->children) { $_->destroy; }
--
Go to http://MarcDashevsky.com to send me e-mail.
| |
|
| "Marc Dashevsky" <usenet@MarcDashevsky.com> wrote in message
news:MPG.2004edf851664a78989b77@news.supernews.com...
> In article <1167794050.824979.269540@s34g2000cwa.googlegroups.com>,
> MrCheatr@gmail.com
> says...
>
> foreach ($parent->children) { $_->destroy; }
Or simply pack all widgets into one frame and then:
$frame->destroy;
My question to the OP would be why he would need to destroy "every" widget?
Jack
| |
| Cheater 2007-01-06, 7:14 pm |
| I'm going to have a menu screen. When the user clicks a button, it will
load a sub. These subs generate the new screen. Is there a better way
to do this?
Jack wrote:
> "Marc Dashevsky" <usenet@MarcDashevsky.com> wrote in message
> news:MPG.2004edf851664a78989b77@news.supernews.com...
>
> Or simply pack all widgets into one frame and then:
>
> $frame->destroy;
>
> My question to the OP would be why he would need to destroy "every" widget?
>
> Jack
| |
| Ch Lamprecht 2007-01-06, 7:14 pm |
| Cheater wrote:
> I'm going to have a menu screen. When the user clicks a button, it will
> load a sub. These subs generate the new screen. Is there a better way
> to do this?
> Jack wrote:
[color=darkred]
Hi,
if you need each screen more than once, you would better create different
toplevels. Use methods 'withdraw','deiconify','raise' to show/hide these
toplevels as needed.
Christoph
--
perl -e "print scalar reverse q/ed.enilno@ergn.l.hc/"
| |
| Petr Vileta 2007-01-06, 7:14 pm |
| "Cheater" <MrCheatr@gmail.com> píse v diskusním príspevku
news:1167859671.268358.140220@s34g2000cwa.googlegroups.com...
> I'm going to have a menu screen. When the user clicks a button, it will
> load a sub. These subs generate the new screen. Is there a better way
> to do this?
I don't know your application but for menu screen you can
1) use Tk::NoteBook
2) define more Frame()'s and not use pack but use grid
my $frame1 = $mw->Frame(...)->grid(-row=>0, -column=>0);
# some widgets to frame2, you can use pack or grid
my $frame2 = $mw->Frame(...)->grid(-row=>0, -column=>0);
# some widgets to frame2, you can use pack or grid
my $frame3 = $mw->Frame(...)->grid(-row=>0, -column=>0);
# some widgets to frame3, you can use pack or grid
Now you can show any frame using
$frame1->raise;
or
$frame2->raise;
or
$frame3->raise;
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
|
|
|
|
|