FAQ Index - Search - Recent Changes - Everything - Add entry

<< Previous Entry | FAQ Entry 2.3 | Next Entry >>

2.3. Is there a checklist of changes to migrate an application from PyGTK-0 to PyGTK-2?

Well, the start of one, thanks to LordVan ([www.lordvan.com] )

  import pygtk
  pygtk.require('2.0')
  import gtk
 * use import gtk instead
 * from gtk import *
 * s/mainloop/gtk.mainloop/g # and other functions calls like 'mainquit'
 * s/Gtk/gtk./g
 * s/Gtk//g
 -         win = GtkWindow(title="Foo bar baz")
 +         win = gtk.Window()
 +         win.set_title("Foo bar baz")
 -         label = GtkLabel(label="Foobar")
 +         label = gtk.Label("Foobar")
 -         self.text = GtkText()
 +         self.textbuffer = gtk.TextBuffer(None)
 +         self.text = gtk.TextView()
 +         self.text.set_buffer(self.textbuffer)

 -         self.text.insert_defaults( use_var )
 +         self.textbuffer.insert_at_cursor( use_var,len(use_var) )

  entry = gtk.Entry()
  font_desc = pango.FontDescription('monospace')
  entry.modify_font(font_desc)

  entry = gtk.Entry()
  entry.realize()
  win = entry.window

  drawingarea.window.draw_point()

 gc.set_clip_rectangle((x, y, width, height))

 option_menu=tree.get_widget("optionmenu1")
 sometext=option_menu.get_children()[0].get()

PyGTK FAQ Wizard | PyGTK Homepage | Feedback to faq at pygtk.org