ruby/tk : hide TkFrame

J

Jun Young Kim

hi, rubists.

quick question's here.

I have two TkFrame instance on main panel and then I want to hide one
of them by some kinds of option(checkbutton or somelike that).

is there possible way to do this?

example)
require "tk"

f1 = TkFrame.new {
relief 'sunken'
borderwidth 3
background "red"
padx 15
pady 20
pack('side' => 'left')
}
f2 = TkFrame.new {
relief 'groove'
borderwidth 1
background "yellow"
padx 10
pady 10
pack('side' => 'right')
}

TkButton.new(f1) {
text 'Button1'
command {print "push button1!!\n"}
pack('fill' => 'x')
}
TkButton.new(f1) {
text 'Button2'
command {print "push button2!!\n"}
pack('fill' => 'x')
}
TkButton.new(f2) {
text 'Quit'
command 'exit'
pack('fill' => 'x')
}

Tk.mainloop


How can I hide frame f2?
 
H

Hidetoshi NAGAI

From: Jun Young Kim <[email protected]>
Subject: ruby/tk : hide TkFrame
Date: Wed, 1 Jul 2009 14:11:58 +0900
Message-ID: said:
I have two TkFrame instance on main panel and then I want to hide one
of them by some kinds of option(checkbutton or somelike that).

What is your purpose?
Probably, most suitable way depends on it.

For example, f2.unpack removes f2 on the window.
And then, if you want to keep the window size,
you'll need call f2.winfo_parent.pack_propagate(false) before f2.upnack.
if your purpose is to make the QUIT button disable,
you should use 'state' option of button widgets.

What do you want really?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top