PDA

View Full Version : Seeking opinions on GUI programming



dmsynck
March 12th, 2008, 10:23 PM
Hi all Ubuntu users,

I have taught myself enough of the basics of Python to be able to put together a fairly large and useful script. Now I want to put a GUI frontend on it. After looking at all the available graphical toolkits, I have pretty much decided to go with PyGTK. What I wanted to get opinions on is this. Should I go ahead and invest the time to learn how to code a GUI by hand using PyGTK, or should I use Glade ?

lnostdal
March 12th, 2008, 10:52 PM
pygtk and glade is the "same thing", or part of the same package ..

* you can chose to generate your gui by making instances of gui widgets "manually" in your code

* you can chose to generate (most of) your gui by parsing xml-files generated by glade and having gtk (libglade) instantiate gui widgets "for you"

* ..or you can combine the two .. this is what you will do generally

imdano
March 12th, 2008, 11:03 PM
In a lot of cases using glade makes things easier, especially if you're just using standard gtk objects. There are other times where its better to have the more fine-tuned control you get if you do things manually. Experiment with both.

Can+~
March 12th, 2008, 11:08 PM
Coding the gtk things directly is a bad idea because:

-You will eat at least 100 lines on definitions, connections and gtk packaging.
-It's always a good practice to split the code from the visual design.
-There's no performance boost, or any advantage on coding directly, at least, the xml file is loaded once and cached.

But, I guess a great way to start learning on using GTK is first coding it manually, later you move to glade with all your new knowledge.

LaRoza
March 13th, 2008, 12:22 AM
-It's always a good practice to split the code from the visual design.
.

You mean split the function from the presentation. One can code that way (in fact, one should code that way)

One doesn't need to use other tools to follow a good development model, although it may help.

pmasiar
March 13th, 2008, 01:02 AM
Simplest way to do GUI is http://www.ferg.org/easygui/ . It does not have events, and it is one interaction per input screen, but that's the beauty of it: for simple cases, it is enough.

For more complex cases, consider Model-view-controller (http://en.wikipedia.org/wiki/Model_view_controller) paradigm - the only way to design maintanable complex GUI and stay sane, IMHO. :-)

LaRoza
March 13th, 2008, 01:04 AM
Simplest way to do GUI is http://www.ferg.org/easygui/ . It does not have events, and it is one interaction per input screen, but that's the beauty of it: for simple cases, it is enough.

For more complex cases, consider Model-view-controller (http://en.wikipedia.org/wiki/Model_view_controller) paradigm - the only way to design maintanable complex GUI and stay sane, IMHO. :-)

Yes, EasyGUI is very nice for most tasks.

I was thinking that, MVC.

Acglaphotis
March 13th, 2008, 02:09 AM
I agree that the backend and the gui should stay separate.