Porting a pygtk app to Windows
Michael Palmer
m_palmer45 at yahoo.ca
Tue Sep 16 14:49:06 EDT 2008
On Sep 16, 12:30 pm, binaryjesus <coolman.gu... at gmail.com> wrote:
> hi everyone,
> first of all
> I had written an app using pygtk module and created the GUI with
> glade.All the development was done on a linux machine and the app was
> working fine all this tme in linux.
>
> now, the thing is i have to change the development environment to
> windows. So this means that i have to port the application to work in
> windows.
>
> Initially i thought that porting an application written using a
> platform independent language and cross-platform window frame work
> would be a piece of cake. Well i guess all the assumptions end there.
> unlike linux, in windows pygtk and the GTK frame work are not
> installed by default.
>
> So, long story short. i installed GTK devel, pygtk, pygobject, pycaro,
> glade ui. Also made a lot of path adjustments (os.path.absolutepath()
> is not portable i guess) and finally got the app to at least start
> without showing an error.
>
> The problem that i am now facing is that nothing shows up in the app.
> No menu, buttons, frames or anything else is visible. When i move the
> cursor over the window it changes into an hour-glass type icon. hoe
> ever all c++ GTK programs seem to render well.
>
> here is a screen shot:http://i36.tinypic.com/x52uk9.jpg
>
> i have written below the startup code of the app:
>
> import pygtk
> pygtk.require('2.0')
> import gtk
> import gtk.glade
> from ConfigParser import ConfigParser
>
> class jDesk(object):
> def __init__(self):
> #self.seclstore.append(["0","Section1"])
> #self.catlstore.append(["cat 1"])
> self.synclstore = gtk.ListStore(str,str,str,str,str,int)
> self.seclstore = gtk.ListStore(str,str)
> self.catlstore = gtk.ListStore(str,str)
> self.process_glade()
>
> def process_glade(self):
> self.gladefile = "gui.glade"
> self.glade = gtk.glade.XML(self.gladefile)
> #windows
> self.main_window = self.glade.get_widget('MainWindow')
> #main window
> self.templatefile = self.glade.get_widget('templatefile')
> self.imageurl = self.glade.get_widget('imageurl')
> self.posttitle = self.glade.get_widget('posttitle')
> self.sectionbox = self.glade.get_widget('sectionbox')
> self.categorybox = self.glade.get_widget('categorybox')
> self.demolink = self.glade.get_widget('demolink')
> self.posttext = self.glade.get_widget('posttext')
> self.statusbar = self.glade.get_widget('statusbar')
>
> self.signal_autoconnect()
> self.main_window.show()
> print '===================main wind created================='
> def run(self):
> try:
> print "Entering GTK main now"
> gtk.main()
> print "Leaving GTK main"
> except:
> print "Exception in main"
>
> if __name__ == "__main__":
> conf = ConfigParser()
> conf.read('settings.cfg')
> gtk.gdk.threads_init()
> app = jDesk()
> app.run()
>
> i have tried a lot of things, checked up paths, checked libcairo but
> nothing seems to help.problem seems to be with pygtk since other c++
> GTK programs like pedgin and GTK demo rn fine.
> So maybe is there any pygtk windows bugs that i coming from linux
> background might not be knowing about or perhaps u have encountered
> such a problem in the past before ?
> Much thanks in advance
> BinaryJ
I haven't tried it myself, but I came across a blog post the other day
that describes a way of building windows installers for pyGTK
applications at
http://unpythonic.blogspot.com/2007/07/pygtk-py2exe-and-inno-setup-for-single.html
More information about the Python-list
mailing list