[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Question about GUI API for Ruby

Jacek Olszak

1/12/2006 11:38:00 AM

Hi... currently I'm developing a small gui application. I don't know
which API for gui creating should I use. I've tried Tk only. For me it
is quite good (but not so many examples, tutorials is available on the
net). I'm looking for an API, in which I'll be able to create text
viever widgets which supports different colors, fonts and styles in one
widget.

Please help...
Jacek

--
Posted via http://www.ruby-....


28 Answers

David Vallner

1/12/2006 11:46:00 AM

0

On Thu, 12 Jan 2006 12:37:35 +0100, Jacek Olszak <jacekolszak@o2.pl> wrote:

> Hi... currently I'm developing a small gui application. I don't know
> which API for gui creating should I use. I've tried Tk only. For me it
> is quite good (but not so many examples, tutorials is available on the
> net). I'm looking for an API, in which I'll be able to create text
> viever widgets which supports different colors, fonts and styles in one
> widget.
>
> Please help...
> Jacek
>


A very frequently used toolkit is FOX. I have certain issues with the
toolkit, religious and from personal observation of certain persistent
quirks, but at any rate, it's indeed fast, mature, and easy to use /
deploy. It seems to feature a styled text widget too.

Other ones you might want to consider is wxruby if you can handle with
slightly lacking documentation, or a Gtk binding, which might be tricky
getting to work on Windows machines.

David Vallner


Jacek Olszak

1/12/2006 11:57:00 AM

0

David Vallner wrote:
> On Thu, 12 Jan 2006 12:37:35 +0100, Jacek Olszak <jacekolszak@o2.pl>
> wrote:
>
>> Hi... currently I'm developing a small gui application. I don't know
>> which API for gui creating should I use. I've tried Tk only. For me it
>> is quite good (but not so many examples, tutorials is available on the
>> net). I'm looking for an API, in which I'll be able to create text
>> viever widgets which supports different colors, fonts and styles in one
>> widget.
>>
>> Please help...
>> Jacek
>>
>
>
> A very frequently used toolkit is FOX. I have certain issues with the
> toolkit, religious and from personal observation of certain persistent
> quirks, but at any rate, it's indeed fast, mature, and easy to use /
> deploy. It seems to feature a styled text widget too.
>
> Other ones you might want to consider is wxruby if you can handle with
> slightly lacking documentation, or a Gtk binding, which might be tricky
> getting to work on Windows machines.
>
> David Vallner

Thanks for reply David!

Fox can be very good.. I've read some docs on FXRuby site and shown that
FreeRide is using it :)

Wxruby can be good but for me documentation is the most important :)
(and as you said there isn't a lot of docs for wxruby). Gtk for me is
not good too, because my primary os is Windows.

Regards
Jacek

--
Posted via http://www.ruby-....


David Vallner

1/12/2006 12:12:00 PM

0

On Thu, 12 Jan 2006 12:57:03 +0100, Jacek Olszak <jacekolszak@o2.pl> wrote:

>
> Thanks for reply David!
>
> Fox can be very good.. I've read some docs on FXRuby site and shown that
> FreeRide is using it :)

I -have- been getting strange behaviour from it sometimes that occured to
other people - dialogs opening with the top left corner being
significantly off the screen. Might be dependent on how the computer is
set up so do check for that when deploying the application.

>
> Wxruby can be good but for me documentation is the most important :)
> (and as you said there isn't a lot of docs for wxruby).

Usually, it's possible to make do with the primary wxWidgets
documentation, but I haven't really used it that extensively to rule out
subtle bugs / incompatibility issues. Also, the project entered the "long
boring rewrite" phase a while ago, and there isn't much apparent activity
the like of public releases. I favor it mostly because of the use of
native widgets (somewhat of a religious issue), and usually swallow the
bitter pill and do my GUI work in wxPython. I wouldn't quite recommend
wxruby for production code yet.

David Vallner


Jacek Olszak

1/12/2006 1:24:00 PM

0

Ok... I've created simple application in FOX, which uses FXText widget.
I'm able to define some styles (called FXHiliteStyle here) to this text
and use them in the future. But I cannot create links, join multiple
defined styles (for example join 'red' with 'bold') etc. (or can I?)
So.... propably I'll back to Tk :(

Regards
Jacek

--
Posted via http://www.ruby-....


tsumeruby

1/12/2006 4:45:00 PM

0

On Thursday 12 January 2006 08:37 pm, Jacek Olszak wrote:
> Hi... currently I'm developing a small gui application. I don't know
> which API for gui creating should I use. I've tried Tk only. For me it
> is quite good (but not so many examples, tutorials is available on the
> net). I'm looking for an API, in which I'll be able to create text
> viever widgets which supports different colors, fonts and styles in one
> widget.
>
> Please help...
> Jacek

Hey, you want to use GTK if you are targetting windows or linux. The GTK
bindings support unicode, and the GTK API is frozen. There are several
downsides to FOX, but it is included with one click. GTK really should be too
as its been around longer and trusted. Reasons have been explained before on
ruby-talk. Should grep the google groups for the reasons. theres also qtruby,
which bound to a rock solid library, but I'm not sure how many more changes
rdale wants.. so until its frozen.. :) GTK is most likely the most stable if
you're wanting pretty. Also, you said you used Tk, check out the Tk::Tile
library, which you'll have to download apart from ruby or tk.

Tsume


Lyle Johnson

1/12/2006 5:20:00 PM

0

On 1/12/06, David Vallner <david@vallner.net> wrote:

> I -have- been getting strange behaviour from it sometimes that occured to
> other people - dialogs opening with the top left corner being
> significantly off the screen. Might be dependent on how the computer is
> set up so do check for that when deploying the application.

It's not clear from your description whether this is a bug in the
application or a bug in FXRuby. At any rate, there are no open bug
reports that sound like what you're describing (see
http://rubyforge.org/tracker/?atid=1223&group_id=300&f...). If
you do believe that it's an FXRuby bug and can file a bug report that
describes the problem and how to reproduce it, I'd appreciate it.


David Vallner

1/12/2006 8:01:00 PM

0

On Thu, 12 Jan 2006 18:20:15 +0100, Lyle Johnson <lyle.johnson@gmail.com>
wrote:

> On 1/12/06, David Vallner <david@vallner.net> wrote:
>
>> I -have- been getting strange behaviour from it sometimes that occured
>> to
>> other people - dialogs opening with the top left corner being
>> significantly off the screen. Might be dependent on how the computer is
>> set up so do check for that when deploying the application.
>
> It's not clear from your description whether this is a bug in the
> application or a bug in FXRuby. At any rate, there are no open bug
> reports that sound like what you're describing (see
> http://rubyforge.org/tracker/?atid=1223&group_id=300&f...) If
> you do believe that it's an FXRuby bug and can file a bug report that
> describes the problem and how to reproduce it, I'd appreciate it.
>


[OT]: your client seems to be acting up, or your fingers slipped and you
used "Reply to all" by mistake. In any case, I received this message both
via ruby-talk, and via my normal e-mail address.

The bug I described I -think- occurs in both FreeRide for the
configuration dialog and the dialog.rb example that comes with the gem. I
believe it's tied to me having set Windows to 120 dpi fonts, which as far
as I know very few other people even know of, much less use, which would
explain the lack of a bug report so far.

That said, I should probably get some screenshots done and file a rep once
I get around to it.

David Vallner


Marcin Mielzynski

1/12/2006 8:24:00 PM

0

Jacek Olszak wrote:

> Fox can be very good.. I've read some docs on FXRuby site and shown that
> FreeRide is using it :)
>

Fox is very good :D. It has very consistent API (every constructor takes
pointer/reference to parent widget/container so it is easy to create
automation code that read's configuration file and builds the whole gui
at runtime (and actually this solution works very fast). The
interpreting code takes approximately 500 loc. An example is attached
(it can be xml or indentation based format)

lopex

!icon:file=res/images/dialogs/player_fwd.png|id=fwd_icon
!icon:file=res/images/dialogs/player_play.png|id=play_icon
!icon:file=res/images/dialogs/player_pause.png|id=pause_icon
!icon:file=res/images/dialogs/player_stop.png|id=stop_icon

!icon:file=res/images/dialogs/clock.png|id=clock_icon

!icon:file=res/images/dialogs/parameters.png|id=parameters_icon
!icon:file=res/images/dialogs/options.png|id=options_icon
!icon:file=res/images/dialogs/statistics.png|id=statistics_icon
!icon:file=res/images/dialogs/kchart.png|id=chart_icon

!icon:file=res/images/dialogs/add.png|id=adds_icon
!icon:file=res/images/dialogs/remove.png|id=removes_icon

_main_window
dialog_box:options=$simulation_title,DECOR_TITLE+DECOR_BORDER+DECOR_CLOSE+PLACEMENT_OWNER+PLACEMENT_VISIBLE,0,0,0,0,2,2,2|main|id=simulation_dialog
vframe:options=LAYOUT_FILL_X+LAYOUT_FILL_Y+FRAME_GROOVE
hframe:options=LAYOUT_FILL_X+LAYOUT_FILL_Y
group_box:options=$simulation_control,FRAME_THICK+GROUPBOX_TITLE_LEFT+LAYOUT_RIGHT+LAYOUT_FILL_X
hframe
label:options=$simulation_control_time
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=time_text
label:options=$simulation_control_ktime
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=ktime_text
label:options='(s)'
check_button:options=$simulation_control_update,*update_graph(true)
hframe:options=LAYOUT_FILL_X
label:options='',%clock_icon,LAYOUT_CENTER_Y,TEXT_ABOVE_ICON
group_box:options='',LAYOUT_FILL_X+FRAME_THICK
hframe:options=LAYOUT_FILL_X
button:options=$simulation_control_loop,%fwd_icon,nil,0,BUTTON_TOOLBAR+BUTTON_NORMAL+LAYOUT_CENTER_X+TEXT_AFTER_ICON|event=command(on_loop)|id=loop_button
button:options=$simulation_control_step,%play_icon,nil,0,BUTTON_TOOLBAR+BUTTON_NORMAL+LAYOUT_CENTER_X+TEXT_AFTER_ICON|event=command(on_step)|id=step_button
button:options=$simulation_control_pause,%pause_icon,nil,0,BUTTON_TOOLBAR+BUTTON_NORMAL+LAYOUT_CENTER_X+TEXT_AFTER_ICON|event=command(on_pause)|id=pause_button
button:options=$simulation_control_stop,%stop_icon,nil,0,BUTTON_TOOLBAR+BUTTON_NORMAL+LAYOUT_CENTER_X+TEXT_AFTER_ICON|event=command(on_stop)|id=stop_button
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_control_delay_title
hframe:options=LAYOUT_RIGHT+LAYOUT_FILL_X
label:options=$simulation_control_delta
slider:options=*delay(100),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=delay_slider
spinner:options=3,*delay|id=delay_spinner
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_control_kernel_steps_title
hframe:options=LAYOUT_RIGHT+LAYOUT_FILL_X
label:options=$simulation_control_kernel_steps
slider:options=*kernel_steps(1),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=kernel_steps_slider
spinner:options=3,*kernel_steps|id=kernel_steps_spinner

tab_book:options=nil,0,LAYOUT_FILL_X+LAYOUT_FILL_Y+LAYOUT_RIGHT|id=tab_book|event=command(tab_changed)

# parameters
tab_item:options=$simulation_parameters_tab_title,%parameters_icon
vframe:options=FRAME_THICK+FRAME_RAISED+LAYOUT_FILL_Y
group_box:options=$simulation_parameters_settings,FRAME_THICK+LAYOUT_FILL_X+LAYOUT_FILL_Y+GROUPBOX_TITLE_LEFT,0,0,0,0,0,0,0,0,0,0
# ni
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_parameters_alpha_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_parameters_alpha
slider:options=*alpha(10),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=alpha_slider
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=alpha_text
# alpha
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_parameters_ni_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_parameters_ni
slider:options=*ni(10),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=ni_slider
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=ni_text
# gamma
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_parameters_gamma_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_parameters_gamma
slider:options=*gamma(10),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=gamma_slider
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=gamma_text
# c1
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_parameters_c1_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_parameters_c1
slider:options=*c1(10),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=c1_slider
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=c1_text
# c2
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_parameters_c2_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_parameters_c2
slider:options=*c2(10),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=c2_slider
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=c2_text
# c
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_parameters_c_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_parameters_c
slider:options=*c(10),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=c_slider
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=c_text
# a
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_parameters_a_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_parameters_a
slider:options=*a(10),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=a_slider
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=a_text

# options
tab_item:options=$simulation_options_tab_title,%options_icon
vframe:options=FRAME_THICK+FRAME_RAISED+LAYOUT_FILL_Y
group_box:options=$simulation_options_settings,FRAME_THICK+LAYOUT_FILL_X+LAYOUT_FILL_Y+GROUPBOX_TITLE_LEFT,0,0,0,0,0,0,0,0,0,0
# ttl
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_options_ttl_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_options_ttl
slider:options=*ttl(0),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=ttl_slider
spinner:options=3,*ttl|id=ttl_spinner
# forward packet size
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_options_fpacket_size_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_options_fpacket_size
slider:options=*fpacket_size(0),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=fpacket_size_slider
spinner:options=3,*fpacket_size|id=fpacket_size_spinner
# backward packet size
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_options_bpacket_size_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_options_bpacket_size
slider:options=*bpacket_size(0),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=bpacket_size_slider
spinner:options=3,*bpacket_size|id=bpacket_size_spinner
# delta
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_options_delta_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_options_delta
slider:options=*delta(0),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=delta_slider
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=delta_text
#spinner:options=3,*delta|id=delta_spinner

# statistics
tab_item:options=$simulation_statistics_tab_title,%statistics_icon|id=stats_tab
vframe:options=FRAME_THICK+FRAME_RAISED+LAYOUT_FILL_Y
group_box:options=$simulation_statistics_cycle,FRAME_THICK+LAYOUT_FILL_X+LAYOUT_FILL_Y+GROUPBOX_TITLE_LEFT,0,0,0,0,0,0,0,0,0,0
matrix:options=2,MATRIX_BY_COLUMNS+LAYOUT_FILL_X+LAYOUT_FILL_Y
label:options=$simulation_statistics_ants_reached
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=ants_reached_text
label:options=$simulation_statistics_times_reached
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=times_reached_text
label:options=$simulation_statistics_times_to_ants_reached
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=times_to_ants_reached_text

label:options=$simulation_statistics_ants_returned
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=ants_returned_text
label:options=$simulation_statistics_times_returned
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=times_returned_text
label:options=$simulation_statistics_times_to_ants_returned
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=times_to_ants_returned_text

label:options=$simulation_statistics_ants_expired
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=ants_expired_text


group_box:options=$simulation_statistics_overall,FRAME_THICK+LAYOUT_FILL_X+LAYOUT_FILL_Y+GROUPBOX_TITLE_LEFT,0,0,0,0,0,0,0,0,0,0
matrix:options=2,MATRIX_BY_COLUMNS+LAYOUT_FILL_X+LAYOUT_FILL_Y
label:options=$simulation_statistics_ants_reached_OA
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=ants_reached_OA_text
label:options=$simulation_statistics_times_reached_OA
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=times_reached_OA_text
label:options=$simulation_statistics_times_to_ants_reached_OA
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=times_to_ants_reached_OA_text

label:options=$simulation_statistics_ants_returned_OA
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=ants_returned_OA_text
label:options=$simulation_statistics_times_returned_OA
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=times_returned_OA_text
label:options=$simulation_statistics_times_to_ants_returned_OA
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=times_to_ants_returned_OA_text

label:options=$simulation_statistics_ants_expired_OA
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=ants_expired_OA_text


tab_item:options=$simulation_chart_title,%chart_icon
vframe:options=FRAME_THICK+FRAME_RAISED+LAYOUT_FILL_Y
group_box:options=$simulation_chart_serie,FRAME_THICK+LAYOUT_FILL_X+GROUPBOX_TITLE_LEFT+LAYOUT_CENTER_X
hframe:options=LAYOUT_CENTER_X
matrix:options=2,MATRIX_BY_COLUMNS+LAYOUT_FILL_X+LAYOUT_FILL_Y
combo_box:options=10,nil,0,LAYOUT_FILL_X+COMBOBOX_STATIC+FRAME_SUNKEN+FRAME_THICK|id=series_combo
button:options=$simulation_chart_serie_add,%adds_icon,nil,0,BUTTON_TOOLBAR+BUTTON_NORMAL|event=command(add_serie)
combo_box:options=10,nil,0,LAYOUT_FILL_X+COMBOBOX_STATIC+FRAME_SUNKEN+FRAME_THICK|id=added_combo
button:options=$simulation_chart_serie_remove,%removes_icon,nil,0,BUTTON_TOOLBAR+BUTTON_NORMAL|event=command(remove_serie)
group_box:options=$simulation_chart_gb_serie,FRAME_THICK+LAYOUT_FILL_X+GROUPBOX_TITLE_LEFT
hframe:options=LAYOUT_CENTER_X
button:options=$simulation_chart_statistics|event=command(normal_chart)
button:options=$simulation_chart_queue_load|event=command(column_chart)
button:options=$simulation_chart_clear|event=command(clear_chart)

David Vallner

1/12/2006 9:23:00 PM

0

On Thu, 12 Jan 2006 17:44:33 +0100, <tsumeruby@tsumelabs.com> wrote:

>
> Hey, you want to use GTK if you are targetting windows or linux. The GTK
> bindings support unicode, and the GTK API is frozen. There are several
> downsides to FOX, but it is included with one click. GTK really should
> be too
> as its been around longer and trusted. Reasons have been explained
> before on
> ruby-talk. Should grep the google groups for the reasons. theres also
> qtruby,
> which bound to a rock solid library, but I'm not sure how many more
> changes
> rdale wants.. so until its frozen.. :) GTK is most likely the most
> stable if
> you're wanting pretty. Also, you said you used Tk, check out the Tk::Tile
> library, which you'll have to download apart from ruby or tk.
>
> Tsume
>


I blame Gtk being mentally associated with a lack of an official binary
distribution for Windows - although I'm going out on a limb here, I don't
really follow happenings around Gtk. Also, anything with a version number
lower than 1.0 tends to be difficult to get past Managers That Think They
Know Tech But Really Don't. And on ocassion, I've had some Windows
programs that bundle a binary Gtk build along not work (notably MudMagic,
haven't really investigated the problem much).

A frozen API isn't everything, ease of deployment is _very_ valuable in
making end-user applications, and fxruby does deliver perfectly in that
respect.

David Vallner


tsumeruby

1/13/2006 7:13:00 AM

0

On Friday 13 January 2006 06:23 am, David Vallner wrote:
> I blame Gtk being mentally associated with a lack of an official binary
> distribution for Windows - although I'm going out on a limb here, I don't

There are windows binaries for ruby-gtk2 and a gtk installer, what are you
talking about?
> A frozen API isn't everything, ease of deployment is _very_ valuable in
> making end-user applications, and fxruby does deliver perfectly in that
> respect.

A frozen API is very important not only for the programmer, but for
distribution. When you have an app with 20,000 lines of code, you don't want
the app to break just because you now have to handle another add-in.

and ease of deployment is very easy with Gtk/ruby-gtk2 as well.. if you read
the fine site :)

Tsume