1

I researched and tried this for two days now and I cannot get gtk to work on Windows 7 with Python 3.4! Whenever I launch my .py file on Python 3.4 with import gtk, I get No module named gtk! I installed pygobject but it did not help. Even gtk3-demo command works in the windows cmd prompt.

I finally got gtk to import (I think) by copying the GTK directory right to C:\Python34\Lib. But now I have a problem with gtk.glade.

Where is this? Where do I copy it from and to where?

1 Answer 1

1

You are possibly using an outdated tutorial, see the current Python GTK 3 tutorial for a more up-to-date reference.

In particular, the way to import GTK has changed in GTK3 to:

from gi.repository import Gtk

And instead of libglade, you would use the newer Gtk.Builder class like so:

ui = Gtk.Builder()
ui.add_from_file("my_glade_file.glade")

(you still develop the UI using Glade, it is only how you access it from your program that has changed).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.