Tk - Ruby/Tk core library design questions

'tk.rb' on CVS already has the method.

OK. Thank you. ( I always behind ... )

To do it, we must check all keys of the configure argument,
and select to call 'wm' command or 'configure' command.
If you request it strongly, I'll try to implement.

I just feel this would be a nice feature, but not sure how many people
needed,
and I know it is not trivial ( check all commands, make sure they have
getter/setter
behaviour, and wrap them like options ... ). I am not strongly needed,
but if
many people think that would be nice, then maybe give it a try? :wink:
BTW: if we really do it, then we may need to keep maintenance in the
future for
new version of TK ( maybe new command come out and need to wrap ... etc
)
So, think again those complexity ...

I thought that is enough because canvas items needs a parent
canvas widget.
Don't you think so?

I think so too. :slight_smile:
I just try to write a quick demo as short as possible, then that error
came out.
After your explication, I know what I have to rewrite it ...
Here is the classic way:
require 'tk' ; TkCanvas.new { |c| TkcRectangle.new(c, 1, 1, 2, 2)
}.pack; Tk.mainloop
My short version which not works:
require 'tk'; TkcRectangle.new(TkCanvas.new.pack, 1,1,2,2);
Tk.mainloop;
Just rewrite it to become:
require 'tk/canvas.rb'; TkcRectangle.new(TkCanvas.new.pack, 1,1,2,2);
Tk.mainloop;
and it is short and works fine.

Thank you again for your help.

To do it, we must check all keys of the configure argument,
and select to call 'wm' command or 'configure' command.
If you request it strongly, I'll try to implement.

Not only the 'wm' command, I also think something like:

TkScale.new(:form=>10, :to=>100, :value=>40, :variable=>v).pack
As you can see there is side-effect.
Hash has no notion of order.
So the set value 40 will modifiy the variable v
depend on the order of :value=>40 and :variable=>v

Message-ID: <1122988891.225677.139700@g14g2000cwa.googlegroups.com>

> To do it, we must check all keys of the configure argument,
> and select to call 'wm' command or 'configure' command.
> If you request it strongly, I'll try to implement.
I just feel this would be a nice feature, but not sure how many people
needed,
and I know it is not trivial ( check all commands, make sure they have
getter/setter
behaviour, and wrap them like options ... ). I am not strongly needed,
but if
many people think that would be nice, then maybe give it a try? :wink:
BTW: if we really do it, then we may need to keep maintenance in the
future for
new version of TK ( maybe new command come out and need to wrap ... etc
)
So, think again those complexity ...

I've commit that to CVS (HEAD and 1.8 branch).
Please try it. :wink:

···

From: email55555@gmail.com
Subject: Re: Tk - Ruby/Tk core library design questions
Date: Tue, 2 Aug 2005 22:26:04 +0900
--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

Message-ID: <1122999376.091739.119310@f14g2000cwb.googlegroups.com>

Not only the 'wm' command, I also think something like:

TkScale.new(:form=>10, :to=>100, :value=>40, :variable=>v).pack
As you can see there is side-effect.
Hash has no notion of order.
So the set value 40 will modifiy the variable v
depend on the order of :value=>40 and :variable=>v

If the order is important, such parameters should not be
treated on a Hash argument.
I'll not unify TkScale#value= to the configure hash.
However, instead of your short example, you can write:
TkScale.new(:from=>10, :to=>100, :variable=>v.set_value(40)).pack

···

From: email55555@gmail.com
Subject: Re: Tk - Ruby/Tk core library design questions
Date: Wed, 3 Aug 2005 01:21:05 +0900
--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

Hidetoshi NAGAI wrote:

I've commit that to CVS (HEAD and 1.8 branch).
Please try it. :wink:

Yes, I tried it. It works.
TkRoot.new(:title=>'you name it.').title += ' OK!'

I still use Ruby 1.8 stable version,
and now get the latest Ruby/Tk from CVS (HEAD)

This kind of mix, I only get one error message.
ruby/lib/ruby/1.8/tk/event.rb:397:
NoMethodError: undefined method `_define_attribute_aliases'
for CallbackSubst:Class

I just replace the new event.rb by old (1.8 stable) event.rb
and everything works fine.

I feel that you guy did a lot of "performance" imporvement.
My program seems start up (and run) fast compare to old 1.8 statble
Ruby/Tk.

Thank you.

Message-ID: <1123171877.665173.86280@g49g2000cwa.googlegroups.com>

This kind of mix, I only get one error message.
ruby/lib/ruby/1.8/tk/event.rb:397:
NoMethodError: undefined method `_define_attribute_aliases'
for CallbackSubst:Class

This method is defined on tkutil.c.
Please get and recompile it, and re-install tkutil.so.

Current Ruby/Tk has no difference between 1.9 and 1.8
without layout of source files.

···

From: email55555@gmail.com
Subject: Re: Tk - Ruby/Tk core library design questions
Date: Fri, 5 Aug 2005 01:16:06 +0900
--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

Message-ID: <20050805.070305.41644986.nagai@ai.kyutech.ac.jp>

This method is defined on tkutil.c.
Please get and recompile it, and re-install tkutil.so.

Maybe, you need get and recompile "tcltklib" also.

···

From: Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
Subject: Re: Tk - Ruby/Tk core library design questions
Date: Fri, 5 Aug 2005 07:03:07 +0900
--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

Hidetoshi NAGAI wrote:

This method is defined on tkutil.c.
Please get and recompile it, and re-install tkutil.so.

Maybe, you need get and recompile "tcltklib" also.

Ok. Thanks for the info.