using Glade/pyGTK questions

Post here if you need help with creating a Graphical User Interface in Python.

using Glade/pyGTK questions

Postby eightbits » Sun Aug 25, 2013 6:18 pm

When examining some of the numerous Glade on line tutorials I see some that set the associated
Glade file as:
Code: Select all
gtk.glade.XML(self.gladefile)

and other examples that use:
Code: Select all
 self.gladefile =”filename.glade”


I am finding this as a little confusing as to which is the correct method or if both are correct or
is it an version issue?

Also, in defining the init function (from a tutorial) I see:
Code: Select all
 def __init__(self):
    self.gladefile = "filename.glade"
    self.builder = gtk.Builder()
    self.builder.add_from_file(self.gladefile)
    self.builder.connect_signals(self)
    self.window = self.builder.get_object("window1")
    self.aboutdialog = self.builder.get_object("aboutdialog1")
    self.statusbar = self.builder.get_object("statusbar1")
    self.window.show()


I think I can understand how the class gets instantiated , I am thinking that the “builder” statements
are just a part of the Glade process and is only used within a Glade type python file(?).

Can someone point me to a thorough tutorial that can explain all or most of the mechanics used to implement
a GUI built using Glade as the GUI portion of the code and the associated python coding?

A lot of the on line tutorials seem to be dated and I see, as mentioned above, different approaches used.
I have searched for days now to see if there are any publications printed or PDF's that apply directly and
specifically to using Glade and Python. (I do see several that seem to use C++).

I have found a rather in depth PDF on using pyGTK but not much mentioned about using Glade.

I considered QT but is it not a package that is for sale, not sure? Not sure how much pf the pyGTK code examples, if any, are applicable in using Glade.

I have not used python very much and will have to learn on my own as I live in a very rural area where there is not much interest in Python or computers in general.
I am using Ubuntu 12.04, Phython 2.7.5 and I have Glade 3.8.0 , so if there is any help I will greatly appreciate that help.
Best Regards.
eightbits
 
Posts: 19
Joined: Sun May 19, 2013 2:42 am

Re: using Glade/pyGTK questions

Postby eightbits » Tue Aug 27, 2013 1:00 am

What ? No one knows........
eightbits
 
Posts: 19
Joined: Sun May 19, 2013 2:42 am

Re: using Glade/pyGTK questions

Postby hrs » Tue Aug 27, 2013 8:30 pm

I don't know the answers to your glade questions but would like to point out that pygtk is a dead end. It might be a better idea to invest your time in a toolkit that is actively being developed.

Also since you say you haven't used Python much, I think you should first learn about classes before starting with gui programming.
hrs
 
Posts: 86
Joined: Thu Feb 07, 2013 9:26 pm

Re: using Glade/pyGTK questions

Postby eightbits » Thu Aug 29, 2013 8:09 pm

It might be a better idea to invest your time in a toolkit that is actively being developed.

hrs: can you make a suggestion? I don't want to use Quickly and QT4. So far, Glade seems to be the way for me to go.
But, I don't find a lot of tutorials that have been a great help to me.

Why is pyGTK almost dead, I thought Glade depended on it?
I have some experience in classes using VB.NET on Windows.
Since I have started using Linux (Ubuntu) I decided that Python was a good development environment and that Glade seems to be a good GUI package to use with Python. I definitely do not want to use C/C++ as a development language. Although I have used C for micro's , but is not the same as micro's are not based on any OS.

I am now retired and this is simply just a hobby and I want to be able to re-do a couple of simple Visual Basic apps for the Linux box.

My original post mentioned some confusion in some examples of using Glade that seem to have different syntax in using the Glade (XML) file and was looking for clarification on that. DO you (hrs) have any information on that?
eightbits
 
Posts: 19
Joined: Sun May 19, 2013 2:42 am

Re: using Glade/pyGTK questions

Postby hrs » Thu Aug 29, 2013 9:58 pm

can you make a suggestion?

My suggestions would be either tkinter or wx because both have plenty Python specific resourses as opposed to for example PyQt where you would mostly need to interpret C++ resources.

I was happily using wx on Python 2.7 until I needed some features of Python 3.x. Last time I checked wx was not ported to 3.x yet but they are working on it. So now I use tkinter on 3.x which is actually pretty nice with the tkinter.ttk extension or at any rate good enough for simple programs (search for "Qt demo" on youtube to see all kinds of fancy stuff that you can't do with tkinter or wx).

For wx there's wxGlade, a GUI builder, which works ok. It seems there are GUI builders for tkinter as well though I've never used one. In the end I think GUI code written by hand is nicer than code from a GUI builder, but a GUI builder can be learning tool.

Why is pyGTK almost dead

pyGTK binds gtk2. gtk2 was mostly developed by the GNOME project. They are now on to GNOME3 or whatever it's called, using gtk3. There are bindings for gtk3 called PyGObject but other than that I don't know anything about it.

I want to be able to re-do a couple of simple Visual Basic apps for the Linux box.

You can't go wrong with either wx or tkinter.

My original post mentioned some confusion in some examples of using Glade that seem to have different syntax in using the Glade (XML) file and was looking for clarification on that. DO you (hrs) have any information on that?

No, sorry.
hrs
 
Posts: 86
Joined: Thu Feb 07, 2013 9:26 pm

Re: using Glade/pyGTK questions

Postby eightbits » Mon Sep 02, 2013 2:30 pm

Thanks hrs. I have been looking into wxPython and ordered a book on using it. I am now aware of wxGlade and another tool , wxGlue or something like that.
It does look better supported (wxpython) than Glade.
After using Windows and VB.net (the free one), I like the ability to incorporate the GUI and code into one single tool. I also like the ability to dynamically position and re-size objects, makes thing easier.
I also realize that open source, it is a little harder to do that. As this is really just a hobby for me, I will not be purchasing any tools if I don't have to. I see there are quite a few approaches to generating Python GUI code . I am now looking forward to receiving the book, “Wxpython in Action” which reviewed positive on Amazon. The books are rather expensive but some of the on line tutorials don't go into the detail(s) that I need to comprehend. Perhaps at the age of 69 I should not be delving into something that can be this complex, but I seem unable to not do that :lol:
Thanks agian for your input(s).
eightbits
 
Posts: 19
Joined: Sun May 19, 2013 2:42 am


Return to GUI

Who is online

Users browsing this forum: dnallov, Google Feedfetcher, washburn_it, Yoriz and 1 guest