Tkinter: diferència entre les revisions
Contingut suprimit Contingut afegit
mCap resum de modificació |
|||
Línia 16: | Línia 16: | ||
def createWidgets(self): |
def createWidgets(self): |
||
self.quitButton = tk.Button(self, text=' |
self.quitButton = tk.Button(self, text='tancar', command=self.quit) |
||
self.quitButton.grid() |
self.quitButton.grid() |
||
Revisió del 10:59, 21 des 2016
Tkinter és un binding de la biblioteca gràfica Tcl/Tk per al llenguatge de programació Python[1]. Tkinter va ser escrit per Fredrik Lundh.[2] Es considera un estàndard per a la interfície gràfica d'usuari (GUI) per Python[3] i és el que ve per defecte amb la instal·lació per Microsoft Windows i Mac OS X. Tkinter és free software i és distribueix amb la llicència Python license.[4] També hi ha altres alternatives disponibles com wxPython, PyQt o PySide i PyGTK que compleixen amb tots els estàndards de component visual.
Exemple
A continuació es descriu una aplicació senzilla amb Tkinter en Python3[5]
#!/usr/bin/env python3
import tkinter as tk
class Application(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master)
self.grid()
self.createWidgets()
def createWidgets(self):
self.quitButton = tk.Button(self, text='tancar', command=self.quit)
self.quitButton.grid()
app = Application()
app.master.title('Exemple')
app.mainloop()
Vegeu també
Referències
- ↑ «Tkinter — Python interface to Tcl/Tk — Python v2.6.1 documentation». [Consulta: 12 març 2009].
- ↑ Shipman, John W. (2010-12-12), Tkinter reference: a GUI for Python, New Mexico Tech Computer Center, <http://infohost.nmt.edu/tcc/help/pubs/tkinter/>. Consulta: 11 gener 2012
- ↑ «Tkinter - Pythoninfo Wiki».
- ↑ http://tkinter.unpythonic.net/wiki/Tkinter
- ↑ «Tkinter 8.5 reference: a GUI for Python».
Enllaços externs
- Lloc web de Tkinter (anglès)
- Introducció a Tkinter (anglès)
- Pensant en Tkinter (anglès)