Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Ruby/tk and paned widget question

Reply
Thread Tools

Ruby/tk and paned widget question

 
 
Nigel Wilkinson
Guest
Posts: n/a
 
      10-19-2004
Hi all

I can create this with

a=TkPanedWindow.new

how do I add childsites, I've tried a.add(left) and thigs like it but can't
find the right one

Cheers
Nigel


 
Reply With Quote
 
 
 
 
Phlip
Guest
Posts: n/a
 
      10-19-2004
Nigel Wilkinson wrote:

> I can create this with
>
> a=TkPanedWindow.new
>
> how do I add childsites, I've tried a.add(left) and thigs like it but

can't
> find the right one


Post more complete code. You might be missing a grid() (which is better than
pack()).

--
Phlip
http://industrialxp.org/community/bi...UserInterfaces


 
Reply With Quote
 
 
 
 
Nigel Wilkinson
Guest
Posts: n/a
 
      10-19-2004
> Post more complete code. You might be missing a grid() (which is better
> than pack()).



OK, here's the panedwindow code


horizsplit = TkPanedWindow.new(parent) {
orient 'vertical'
}
horizsplit.add(left)
horizsplit.add(right)
horizsplit.pack( 'fill' => 'both' )


Its failing saying that

undefined local variable or method `left' for #<MainGUI:0x403949e8>
(NameError)

Thanks
Nigel


 
Reply With Quote
 
Hidetoshi NAGAI
Guest
Posts: n/a
 
      10-19-2004
Hi,

From: Nigel Wilkinson <(E-Mail Removed)>
Subject: Re: Ruby/tk and paned widget question
Date: Wed, 20 Oct 2004 07:35:47 +0900
Message-ID: <(E-Mail Removed)>
> horizsplit = TkPanedWindow.new(parent) {
> orient 'vertical'
> }


Do you really want to set "vertical"?
If "orient" option is "vertical", widgets are stacked vertically
in the panedwindow.
The words, "horizsplit", "left" and "right", don't denote "vertical stack".

> horizsplit.add(left)
> horizsplit.add(right)
> horizsplit.pack( 'fill' => 'both' )


You must give widgets for TkPanedWindow#add.
For example,

horizsplit = TkPanedWindow.new(parent, rient=>:horizontal){
add(TkListbox.new(horizsplit).insert(:end, 'lbox1'))
add(TkListbox.new(horizsplit).insert(:end, 'lbox2'))
add(TkListbox.new(horizsplit).insert(:end, 'lbox3'))

pack(:fill=>:both, :expand=>true)
}
horizsplit.panes.each_with_index{|lbox, idx| lbox.insert(:end, idx)}

--
Hidetoshi Nagai ((E-Mail Removed))


 
Reply With Quote
 
Nigel Wilkinson
Guest
Posts: n/a
 
      10-19-2004


--On Wednesday, October 20, 2004 08:02:41 +0900 Hidetoshi NAGAI
<(E-Mail Removed)> wrote:

> Hi,
>
> From: Nigel Wilkinson <(E-Mail Removed)>
> Subject: Re: Ruby/tk and paned widget question
> Date: Wed, 20 Oct 2004 07:35:47 +0900
> Message-ID: <(E-Mail Removed)>
>> horizsplit = TkPanedWindow.new(parent) {
>> orient 'vertical'
>> }

>
> Do you really want to set "vertical"?
> If "orient" option is "vertical", widgets are stacked vertically
> in the panedwindow.
> The words, "horizsplit", "left" and "right", don't denote "vertical
> stack".
>
>> horizsplit.add(left)
>> horizsplit.add(right)
>> horizsplit.pack( 'fill' => 'both' )

>
> You must give widgets for TkPanedWindow#add.
> For example,
>
> horizsplit = TkPanedWindow.new(parent, rient=>:horizontal){
> add(TkListbox.new(horizsplit).insert(:end, 'lbox1'))
> add(TkListbox.new(horizsplit).insert(:end, 'lbox2'))
> add(TkListbox.new(horizsplit).insert(:end, 'lbox3'))
>
> pack(:fill=>:both, :expand=>true)
> }
> horizsplit.panes.each_with_index{|lbox, idx| lbox.insert(:end, idx)}
>
> --
> Hidetoshi Nagai ((E-Mail Removed))
>


Thanks for that, it works a treat. Please excuse my elementary ignorance
but I'm trying to teach myself some programing and am new to everything and
trying to piece it together from what documentation there is.

Thanks again
Nigel




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Tkinter.event.widget: handler gets name instead of widget. Terry Reedy Python 15 07-16-2012 10:32 AM
Re: Tkinter.event.widget: handler gets name instead of widget. Frederic Rentsch Python 0 07-09-2012 08:39 PM
Tkinter.event.widget: handler gets name instead of widget. Frederic Rentsch Python 0 07-08-2012 09:19 PM
user interface widget: ordered selection list: do any UI library has this widget? zhangweiwu@realss.com Javascript 0 10-10-2006 01:02 AM
Tkinter question - proper output in Text widget T. Kaufmann Python 0 07-09-2003 02:01 PM



Advertisments