Graphische Oberfläche FAQ
*************************


Allgemeine GUI Fragen
=====================


Welche GUI Toolkits existieren für Python?
==========================================

Standard-Python-Builds enthalten eine objektorientierte Schnittstelle
zum Tcl/Tk-Widget-Set namens tkinter. Diese ist wahrscheinlich am
einfachsten zu installieren (da sie bei den meisten
Binärdistributionen von Python enthalten ist) und zu verwenden.
Weitere Informationen zu Tk, einschließlich Hinweisen zum Quellcode,
findest du auf der Tcl/Tk-Homepage. Tcl/Tk ist vollständig portierbar
auf macOS, Windows und Unix.

Je nach Zielplattform(en) gibt es auch mehrere Alternativen. Eine
Liste von plattformübergreifenden und plattformspezifischen GUI-
Frameworks findest du im Python-Wiki.


Tkinter Fragen
==============


Wie friere ich Tkinter-Apps ein?
--------------------------------

Freeze ist ein Werkzeug zum Erstellen eigenständiger Anwendungen. Beim
Einfrieren von Tkinter-Anwendungen sind diese jedoch nicht wirklich
eigenständig, da die Anwendung weiterhin die Tcl- und Tk-Bibliotheken
benötigt.

One solution is to ship the application with the Tcl and Tk libraries,
and point to them at run-time using the "TCL_LIBRARY" and "TK_LIBRARY"
environment variables.

To get truly stand-alone applications, the Tcl scripts that form the
library have to be integrated into the application as well. One tool
supporting that is SAM (stand-alone modules), which is part of the Tix
distribution (https://tix.sourceforge.net/).

Build Tix with SAM enabled, perform the appropriate call to
"Tclsam_init()", etc. inside Python's "Modules/tkappinit.c", and link
with libtclsam and libtksam (you might include the Tix libraries as
well).


Ist es möglich Tk Events verarbeitet, während ich auf die I/O warte?
--------------------------------------------------------------------

On platforms other than Windows, yes, and you don't even need threads!
But you'll have to restructure your I/O code a bit.  Tk has the
equivalent of Xt's "XtAddInput()" call, which allows you to register a
callback function which will be called from the Tk mainloop when I/O
is possible on a file descriptor.  See File Handlers.


Ich bekomme keine Key-Bindings zum funktionieren in Tkinter: warum?
-------------------------------------------------------------------

An often-heard complaint is that event handlers bound to events with
the "bind()" method don't get handled even when the appropriate key is
pressed.

Die häufigste Ursache ist, dass das Widget, auf das die Bindung
angewendet wird, keinen "Tastaturfokus" hat. Schau dir die Tk-
Dokumentation zum focus-Befehl an. Normalerweise erhält ein Widget den
Tastaturfokus durch einen Klick darauf (nicht jedoch bei Labels; siehe
die takefocus-Option).
