How do I do GTK+ 3 development in pyCharm 2.5?

Python and pyCharm n00b here.

I have pyCharm 2.5 installed on Ubuntu 12.04 Beta 2.  I want to use Glade 3.12 to create UIs for my pyCharm project.  I'm getting errors when I use GtkBuilder to read in the glade file and generate my UI.  I'm importing the gtk namespace but the external reference is gtk-2.0.  How do I import and use gtk3?

Any help would be most appreciated.  Thanks.

2 comments
Comment actions Permalink

If you run python from the command line and 'import gtk', does it import GTK 2 or GTK 3?

0
Comment actions Permalink

>>> import gtk

>>> gtk

<module 'gtk' from '/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.pyc'>

Looks like gtk-2.0.  Here is code I was able to get working in the IDE:
from gi.repository import Gtk, Gio
from Handlers import *
class PpFileFinder:
    def __init__(self):
        self.builder = Gtk.Builder()
        self.uifile = 'glade/main_window.glade'
        self.builder.add_from_file(self.uifile)
        self.window = self.builder.get_object('main_window')
        self.window.connect('destroy', Handlers.on_main_window_destroy) # allows app to be killed cleanly
        self.builder.connect_signals(Handlers())    # connect our signal handlers
        self.window.show()
if __name__ == '__main__':
    pp_file_finder = PpFileFinder()
    Gtk.main()
This code executes and the UI I created in Glade 3.12 executes correctly.  The references to Gtk and Gio from the import statement are reported as unresolved by pyCharm however.  I'm not sure if this is actually creating a Gtk3?
What do you think?  Thanks for the assistance.
0

Please sign in to leave a comment.