17.12.2012 Views

Programmation PYTHON - Zenk - Security - Repository

Programmation PYTHON - Zenk - Security - Repository

Programmation PYTHON - Zenk - Security - Repository

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Widgets sur la même ligne<br />

>>> from Tkinter import *<br />

>>> racine = Tk()<br />

>>> ok = Button(racine)<br />

>>> ok['text'] = 'OK'<br />

>>> cancel = Button(racine)<br />

>>> cancel['text'] = 'Cancel'<br />

>>> ok.pack(side=LEFT)<br />

>>> cancel.pack(side=LEFT)<br />

Options et méthodes d’un widget<br />

Principaux modules, partie 3<br />

CHAPITRE 10<br />

Chaque widget possède un certain nombre de propriétés, appelées options, qui sont<br />

utilisées par le système pour sa manipulation et son affichage.<br />

Les options peuvent être lues et configurées comme des éléments de dictionnaire, ou<br />

spécifiées en paramètres du constructeur.<br />

Manipulation des options d’un widget<br />

>>> import Tkinter<br />

>>> mon_texte = Tkinter.Text()<br />

>>> mon_texte['font']<br />

'-*-*-medium-r-normal--14-*-*-*-c-*-iso8859-15'<br />

>>> mon_texte['state']<br />

'normal'<br />

>>> mon_texte['height']<br />

'24'<br />

>>> mon_texte['height'] = '50'<br />

Les docstrings des constructeurs de chaque classe permettent de s’informer sur ses<br />

options disponibles.<br />

Options de Text<br />

>>> import Tkinter<br />

>>> Tkinter.Text.__doc__<br />

'Text widget which can display text in various forms.'<br />

>>> print(Tkinter.Text.__init__.__doc__)<br />

Construct a text widget with the parent MASTER.<br />

STANDARD OPTIONS<br />

background, borderwidth, cursor,<br />

exportselection, font, foreground,<br />

highlightbackground, highlightcolor,<br />

331

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!