Tienes mucho código que se repite te recomiendo hacer clases o métodos mas generales.
Código Python:
Ver original#coding: cp1252
import gtk
class Ventana(gtk.Window):
def __init__(self, title, size, resizable=False):
gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
self.set_position(gtk.WIN_POS_CENTER)
self.nextWindow = None
self.backWindow = None
self.set_title(title)
self.set_border_width(10)
self.set_size_request(*size)
self.set_resizable(resizable)
self.hbox = gtk.HBox()
self.back = gtk.Button("Back")
self.next = gtk.Button("Next")
self.add(self.hbox)
self.hbox.add(self.back)
self.hbox.add(self.next)
self.next.connect("clicked", self.onNext)
self.back.connect("clicked", self.onBack)
self.connect("destroy", self.onDestroy)
def onDestroy(self, event):
gtk.main_quit()
def onBack(self, event):
if self.backWindow is not None:
self.hide()
self.backWindow.show_all()
def onNext(self, event):
if self.nextWindow is not None:
self.hide()
self.nextWindow.show_all()
class MyApp():
def __init__(self):
ventana1 = Ventana("Ventana 1", (300, 50))
ventana2 = Ventana("Ventana 2", (300, 50))
ventana3 = Ventana("Ventana 3", (300, 50))
ventana1.nextWindow = ventana2
ventana2.nextWindow = ventana3
ventana3.backWindow = ventana2
ventana2.backWindow = ventana1
ventana1.show_all()
if __name__ == "__main__":
app = MyApp()
gtk.main()