Ruby seems pretty eash to code and understand. However, as a
non-professional programmer, I find GUI the hardest part so far.
GTK didn't work out of the box on windows. It is too bad because it
looked like it would be one of the better GUI choices. I guess I will
have to try FOX.
Any suggestions?
Are there any good examples of getting tk widget data to ruby?
Here is a simple example where I try to build an interface for the user
to pick information which will then be sent to ruby to process.
#example:
require 'tk'
cash_locs=['NONE','NY1','NY2','NJ1','ETC.']
root = TkRoot.new() { title "PICK LOCATION" }
bar = TkScrollbar.new(root).pack('side'=>'right', 'fill'=>'y')
fromLoc = TkVariable.new
list = TkListbox.new(root){}
list.pack('side'=>'left', 'fill'=>'both', 'expand'=>true)
list.yscrollbar(bar)
These days most people use the web for their GUI's. Have you considered
this? It doesn't have to be a web app per se. Ruby has lots of good
options in this area.
Generally, gui is the hard part of software that has to communicate
with the user. It takes a lot of work to get at least some gui with
the most importatnt options somewhere, and even more difficult to make
one that is easy to use.
Some people find gui builders helpful. They allow you to design
dialogs, menus, etc, and just load them ito your application. iirc
qtruby supports such thing.
Creating dialogs on the fly is more versatile. You can add different
controls when your application is in different states. But then you
should look for toolkit with ruby bindings that makes constructing the
layout easy.
For example, the tk toolkit only provides very primitive ways of
arranging elements. I am not sure if the ruby library provides some
more complex layouts. But with tk alone it may be quite hard to
create a dialog with different kinds of elements that won't make the
users run away
Thanks
Michal
···
On 4/4/06, greg.rb <ghalsey@yahoo.com> wrote:
Ruby seems pretty eash to code and understand. However, as a
non-professional programmer, I find GUI the hardest part so far.
I am thinking about this problem at the moment. There are a lot of
toolkits for ruby, but they all require different libraries and are a
bit painful to get running. I am writing software for both OSX and
linux.
I have played with the following toolkits but I haven't made any decisions:
- Gtk2
- Qt
- wxRuby
There are plenty of others but one thing that I would like to see/like
to start is a wrapper that allows you to switch between all of the
given frameworks using some sort of configuration.
I think it would be good to describe the interface for a button,
window, pane etc and then put wrapper classes around all of the
toolkit implementation classes.
I'm not sure how much interest this would generate in the community
but I would be interested to find out.
Cheers,
Carl.
···
On 4/5/06, Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> wrote:
From: "greg.rb" <ghalsey@yahoo.com>
Subject: is GUI a weak point?
Date: Wed, 5 Apr 2006 05:23:59 +0900
Message-ID: <1144181980.267658.187480@j33g2000cwa.googlegroups.com>
> Are there any good examples of getting tk widget data to ruby?
>
> Here is a simple example where I try to build an interface for the user
> to pick information which will then be sent to ruby to process.
I couldn't understand what you want to ask.
Although the following is one of the samples rewriting yours,
it may not be able to answer your question.
require 'tk'
cash_locs=['NONE','NY1','NY2','NJ1','ETC.']
#--------------------------------
# callback function
def put_picked_value(s)
puts 'USER PICKED: ' + s
end
Layout options in Tk and most GUI toolkits are much less primitive
than HTML layout.
···
On 4/5/06, Michal Suchanek <hramrach@centrum.cz> wrote:
On 4/4/06, greg.rb <ghalsey@yahoo.com> wrote:
For example, the tk toolkit only provides very primitive ways of
arranging elements. I am not sure if the ruby library provides some
more complex layouts. But with tk alone it may be quite hard to
create a dialog with different kinds of elements that won't make the
users run away
There are plenty of others but one thing that I would like to see/like
to start is a wrapper that allows you to switch between all of the
given frameworks using some sort of configuration.
Seems like a lot of effort for very little return. As somebody else has
already said, if you want a cross-platform GUI, you're probably going to
want to be using Rails.
There really isn't such thing as a cross-platform GUI application,
outside of web-land. It always needs tweaking, refining, polishing and
testing for every major platform; as a result, what you're suggesting
offers very little.
And Lo, the lord spake, and he gaveth of the world CSS, and saw that it
was good.
Of course, that's an issue for graphic designers. We're programmers. Let
people with some taste do the CSS and laying out.
Martin
···
On Wed, Apr 05, 2006 at 08:57:30PM +0900, Mark Volkmann wrote:
On 4/5/06, Michal Suchanek <hramrach@centrum.cz> wrote:
> On 4/4/06, greg.rb <ghalsey@yahoo.com> wrote:
> For example, the tk toolkit only provides very primitive ways of
> arranging elements. I am not sure if the ruby library provides some
> more complex layouts. But with tk alone it may be quite hard to
> create a dialog with different kinds of elements that won't make the
> users run away
Layout options in Tk and most GUI toolkits are much less primitive
than HTML layout.
> For example, the tk toolkit only provides very primitive ways of
> arranging elements. I am not sure if the ruby library provides some
> more complex layouts. But with tk alone it may be quite hard to
> create a dialog with different kinds of elements that won't make the
> users run away
Layout options in Tk and most GUI toolkits are much less primitive
than HTML layout.
HTMLayout is html-based layouting engine, which has standard-simple widgets
(edit, checkbox, combod...) and allows to create new widgets in plain HTML.
The engine is small and fast and doesn't relies on IE, or Gecko, or
something else. As for now, it is working on Windows only (Mac planned, *nix
questionnable) and is free for non-commercial use.
I am planning to publish my Ruby wrapper for HTMLayout (wrapper is codenamed
HTMR) on rubyforge IF there would be interest to such project.
Java offers cross platform gui development that doesn't require
tweaking. Rails is great but webapps aren't everything. When you are
trying to develop 3d applications or applications that just need to be
run on a desktop (there are still plenty) then ruby is lacking.
···
On 4/5/06, azrael@cream.org <azrael@cream.org> wrote:
> There are plenty of others but one thing that I would like to see/like
> to start is a wrapper that allows you to switch between all of the
> given frameworks using some sort of configuration.
>
Seems like a lot of effort for very little return. As somebody else has
already said, if you want a cross-platform GUI, you're probably going to
want to be using Rails.
There really isn't such thing as a cross-platform GUI application,
outside of web-land. It always needs tweaking, refining, polishing and
testing for every major platform; as a result, what you're suggesting
offers very little.
There are plenty of others but one thing that I would like to see/like
to start is a wrapper that allows you to switch between all of the
given frameworks using some sort of configuration.
Seems like a lot of effort for very little return. As somebody else has
already said, if you want a cross-platform GUI, you're probably going to
want to be using Rails.
Using Rails and a web interface is a nice way to present data to an end user, but it's not always a viable solution. For example, my company does diesel engine testing in real time. There's no way a web based Rails interface would even come close to being able to meet our needs for that.
Now, to present the generated data to the end user - Rails works beautifully. But the web is not the end all be all for GUI applications.
There really isn't such thing as a cross-platform GUI application,
outside of web-land. It always needs tweaking, refining, polishing and
testing for every major platform; as a result, what you're suggesting
offers very little.
I would argue the same is true in webland, since most people designer end up having to support IE, Firefox, Safari, and more.
···
On Apr 5, 2006, at 6:29 AM, azrael@cream.org wrote:
I haven't tried Gtk or wxRuby, but FxRuby (based on FOX GUI) is quite
good. I find it to be easier to use than Ruby/Tk - for example, in
FxRuby, scrollbars come for free, there's a TreeList that's as easy to
use as any other language's tree view, and keyboard shortcuts (in a list
box, press 'b' and the selection should jump to the first item beginning
with 'b', that kind of thing) and mouse scroll wheels tend to work for
free.
One issue with Ruby is that there's no full all-singing-all-dancing IDE
which will do a lot of the hard work for you. For example, C# guys
(including me when I'm not writing installations or programming Ruby)
get VS.NET or #Develop, both of which have form designers. Since the
form designer works out all the positioning, it makes it easier for the
programmer.
However, since languages like Ruby don't have a full IDE (yet), you have
to do more manually. To alleviate this, languages such as Ruby tend to
use GUI libraries that make this as simple as possible. However, this
does not result in GUIs that look particularly nice, and .
Believe me, it doesn't. I've spent a significant proportion of my
professional career pushing against this prevalent misfact.
Friends don't let friends Swing.
SWT, despite IBM's claims to the contrary, needs separate builds for
each platform, similar but not the same UI code, and a significant
amount of work to get the UI to look and feel "right" on Windows, Linux
and Mac OS X, and fit in fully with its UI conventions and way of
working.
Even then, SWT is DOG SLOW on Linux, almost to the point of uselessness.
See: Eclipse.
Ruby's nearest equivalent to SWT is wxRuby, which you've already tried.
There is no such thing as a cross-platform UI. Even with wxRuby, you'll
need to do a lot of work to get the UI to a point where Mac users,
Windows users and Linux users will all hate it equally.
Martin
···
On Wed, Apr 05, 2006 at 07:37:27PM +0900, Carl Woodward wrote:
Java offers cross platform gui development that doesn't require
tweaking.
I haven't tried Gtk or wxRuby, but FxRuby (based on FOX GUI) is quite
good. I find it to be easier to use than Ruby/Tk - for example, in
FxRuby, scrollbars come for free, there's a TreeList that's as easy to
use as any other language's tree view, and keyboard shortcuts (in a list
box, press 'b' and the selection should jump to the first item beginning
with 'b', that kind of thing) and mouse scroll wheels tend to work for
free.
One issue with Ruby is that there's no full all-singing-all-dancing IDE
which will do a lot of the hard work for you. For example, C# guys
(including me when I'm not writing installations or programming Ruby)
get VS.NET or #Develop, both of which have form designers. Since the
form designer works out all the positioning, it makes it easier for the
programmer.
However, since languages like Ruby don't have a full IDE (yet), you have
to do more manually. To alleviate this, languages such as Ruby tend to
use GUI libraries that make this as simple as possible. However, this
does not result in GUIs that look particularly nice, and .
There are plenty of others but one thing that I would like to see/like
to start is a wrapper that allows you to switch between all of the
given frameworks using some sort of configuration.
Seems like a lot of effort for very little return. As somebody else has
already said, if you want a cross-platform GUI, you're probably going to
want to be using Rails.
Using Rails and a web interface is a nice way to present data to an end
user, but it's not always a viable solution. For example, my company
does diesel engine testing in real time. There's no way a web based
Rails interface would even come close to being able to meet our needs
for that.
Until they give the browser persistent connections to the server =)
Zach
···
On Apr 5, 2006, at 6:29 AM, azrael@cream.org wrote:
> Using Rails and a web interface is a nice way to present data to an end
> user, but it's not always a viable solution. For example, my company
> does diesel engine testing in real time. There's no way a web based
> Rails interface would even come close to being able to meet our needs
> for that.
>
Until they give the browser persistent connections to the server =)
Look at what GMail has been able to do with XMLHttpRequest.
If I were you, I'd check out Rails 1.1's RJS support, Dojo, etc., and
check out some of the suprisingly fab stuff you can do with Async
Javascript.