Hallo. Am Samstag, den 23.10.2004, 19:31 +0200 schrieb Gerold Penz:
Marcus Habermehl schrieb:
Aber GTK+ bringt ne Menge zum Installieren mit. War zumindest bei meinem letzten Besucht auf der HP so. Davon abgesehen, dass es mir nicht gelungen ist, GTK unter Windows zu installieren.
Wenn es mir irgendwann mal gelingt WinXP unter QEmu zu installieren, werde ich mir die Dateien mal downloaden uns installieren. Scheint wirklich einfacher zu sein, als bei meinem letzten Rundgang.
Allerdings würde ich PyGTK nicht gerade genial-einfach nennen. Außer du meinst das in Verbindung mit Glade. Das ist wirklich easy, wen man erstmal den Ansatz hat.
Natürlich meine ich es so, also in Verbindung mit Glade ;-)
Hätte ja auch sein können, dass du sowohl, als auch meinst.
Ich finds allerdings besser ohne Glade zu arbeiten. Zumindest im Skript.
Das ist Sache des Programmierers. Solange es nicht stört, dass zum Skript selbst, auch noch eine Glade-Datei mitgeliefert wird,... warum nicht?
Ich meinte es ja aus Sicht des Programmierers. Wenn ich ein Unterfenster öffne, und dieses über das X in der (mir fällt gerade nicht der Name ein) Leiste gaanz oben, worüber man maximieren und minimieren kann, schließe, gelang es mir bisher nicht, dass Fenster erneut darzustellen. Ich glaube, dass ich das Problem sogar schon mal hier gepostet habe. Hab das Ganze jetzt ohne Glade versucht. Und siehe da. Es funktioniert problemlos.
Glade benutze ich eigentlich als PyGTK-Hilfe. Ich baue also das GUI unter Glade auf und schaue dann, wie die Aufrufe sind. Klappt zwar nicht immer, ist aber erstmal einfacher, als help(gtk.XYZ) oder die Referenz.
Ich finde die Trennung zwischen Benutzeroberfläche und funktionaler Programmierung nicht schlecht.
Na, ja. Mit etwas Ordnung innerhalb des Skriptes hat man da auch so etwas wie eine Trennung. Notfalls noch ein paar Kommentare eingefügt, und schon ist es doch durchschaubar.
Bitte beachten: Seit GTK 2 muss anders importiert werden. Das sieht dann so aus:
import pygtk pygtk.require("2.0") import gtk import gtk.glade
Muss nicht unbedingt. Auf pygtk und pygtk.require habe ich bisher immer verzichtet. Hatte noch keine Probleme. Ich denke aber mal, dass die Probleme auftreten werden, wenn man auch GTK 1.x installiert hat.
Auf ein mit Glade erstelltes Fenster kann dann so zugegriffen werden:
self.wTree = gtk.glade.XML("<GLADEDATEI>", "<FENSTERNAME>") self.window = self.wTree.get_widget("<FENSTERNAME>")
Hier hab ich immer mit get_widget gearbeitet. Also xml = gtk.glade.XML(<Glade-Datei>) window1 = xml.get_widget('window1') Mir fällte gerade auf. Das ist ja eigentlich das Selbe, wie bei dir. Aber warum hast du bei gtk.glade.XML noch einen Fensternamen drin? Was für ein Fenster/Widget liest du denn damit ein? Gruß Marcus _______________________________________________ python-de maillist - python-de@python.net http://python.net/mailman/listinfo/python-de