Antarmuka Pengguna Grafis FAQ
*****************************


Pertanyaan Umum GUI
===================


What platform-independent GUI toolkits exist for Python?
========================================================

Bergantung pada platform apa yang Anda bidik, ada beberapa. Beberapa
dari mereka belum di-porting ke Python 3. Setidaknya Tkinter dan` Qt`_
diketahui kompatibel dengan Python 3.


Tkinter
-------

Standard builds of Python include an object-oriented interface to the
Tcl/Tk widget set, called tkinter.  This is probably the easiest to
install (since it comes included with most binary distributions of
Python) and use. For more info about Tk, including pointers to the
source, see the Tcl/Tk home page.  Tcl/Tk is fully portable to the Mac
OS X, Windows, and Unix platforms.


wxWidgets
---------

wxWidgets (https://www.wxwidgets.org) is a free, portable GUI class
library written in C++ that provides a native look and feel on a
number of platforms, with Windows, Mac OS X, GTK, X11, all listed as
current stable targets.  Language bindings are available for a number
of languages including Python, Perl, Ruby, etc.

wxPython is the Python binding for wxwidgets.  While it often lags
slightly behind the official wxWidgets releases, it also offers a
number of features via pure Python extensions that are not available
in other language bindings.  There is an active wxPython user and
developer community.

Baik wxWidgets dan wxPython adalah perangkat lunak gratis, sumber
terbuka, dengan lisensi permisif yang memungkinkan penggunaannya dalam
produk komersial serta freeware atau shareware.


Qt
--

There are bindings available for the Qt toolkit (using either PyQt or
PySide) and for KDE (PyKDE4). PyQt is currently more mature than
PySide, but you must buy a PyQt license from Riverbank Computing if
you want to write proprietary applications.  PySide is free for all
applications.

Qt 4.5 upwards is licensed under the LGPL license; also, commercial
licenses are available from The Qt Company.


Gtk+
----

The GObject introspection bindings for Python allow you to write GTK+
3 applications.  There is also a Python GTK+ 3 Tutorial.

The older PyGtk bindings for the Gtk+ 2 toolkit have been implemented
by James Henstridge; see <http://www.pygtk.org>.


Kivy
----

Kivy is a cross-platform GUI library supporting both desktop operating
systems (Windows, macOS, Linux) and mobile devices (Android, iOS).  It
is written in Python and Cython, and can use a range of windowing
backends.

Kivy adalah perangkat lunak gratis dan sumber terbuka yang
didistribusikan di bawah lisensi MIT.


FLTK
----

Python bindings for the FLTK toolkit, a simple yet powerful and mature
cross-platform windowing system, are available from the PyFLTK
project.


OpenGL
------

Untuk pengikatan OpenGL, lihat PyOpenGL.


What platform-specific GUI toolkits exist for Python?
=====================================================

By installing the PyObjc Objective-C bridge, Python programs can use
Mac OS X's Cocoa libraries.

:ref:>>`<<Pythonwin <windows-faq>`oleh Mark Hammond menyertakan
antarmuka ke Microsoft Foundation Classes dan lingkungan pemrograman
Python yang sebagian besar ditulis dengan Python menggunakan kelas
MFC.


Pertanyaan-pertanyaan Tkinter
=============================


Bagaimana cara membekukan aplikasi Tkinter?
-------------------------------------------

Freeze is a tool to create stand-alone applications.  When freezing
Tkinter applications, the applications will not be truly stand-alone,
as the application will still need the Tcl and Tk libraries.

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 (http://tix.sourceforge.net/).

Bangun Tix dengan SAM diaktifkan, lakukan panggilan yang sesuai ke
"Tclsam_init()", dll. Di dalam Python : file:` Modules tkappinit.c`,
dan tautkan dengan libtclsam dan libtksam (Anda mungkin menyertakan
pustaka Tix juga ).


Can I have Tk events handled while waiting for I/O?
---------------------------------------------------

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.


Saya tidak bisa mendapatkan pengikatan kunci untuk bekerja di Tkinter: mengapa?
-------------------------------------------------------------------------------

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.

The most common cause is that the widget to which the binding applies
doesn't have "keyboard focus".  Check out the Tk documentation for the
focus command. Usually a widget is given the keyboard focus by
clicking in it (but not for labels; see the takefocus option).
