Diferències
Ací es mostren les diferències entre la revisió seleccionada i la versió actual de la pàgina.
| Ambdós costats versió prèvia Revisió prèvia | |||
| info:cursos:pue:python-pcpp1:m3:1.1 [22/12/2023 02:14] – mate | info:cursos:pue:python-pcpp1:m3:1.1 [22/12/2023 03:20] (actual) – mate | ||
|---|---|---|---|
| Línia 196: | Línia 196: | ||
| == Events | == Events | ||
| + | Have you noticed? We silently introduced a new word into our discussion. It’s the **event**. | ||
| + | |||
| + | What it is? Or rather, what could it be? | ||
| + | |||
| + | There are lots of events which an event manager is committed to recognizing, | ||
| + | |||
| + | * pressing the mouse button; | ||
| + | * releasing the mouse button (actually, an ordinary mouse click consists of these two subsequent events) | ||
| + | * moving the mouse cursor; | ||
| + | * dragging something under the mouse cursor; | ||
| + | * pressing and releasing a key; | ||
| + | * tapping a screen; | ||
| + | * tracking the passage of time; | ||
| + | * monitoring a widget’s state change; | ||
| + | * and many, many more... | ||
| + | |||
| + | == TkInter | ||
| + | Unfortunately, | ||
| + | |||
| + | This means that if we want to build portable GUI applications (i.e., apps able to work under different operating environments that always look the same) we need something more – we need an adapter. A set of uniform facilities enables us, the programmers, | ||
| + | |||
| + | Such an adapter is called a **widget toolkit**, a **GUI toolkit**, or a **UX library**. | ||
| + | |||
| + | One of these toolkits, which is very attractive to us, is Tk. | ||
| + | |||
| + | Here are some of its features: | ||
| + | |||
| + | * it’s free and open (we don’t need to pay for anything) | ||
| + | * it has been developed since 1991 (which means it’s stable and mature) | ||
| + | * it defines and serves more than thirty different universal widgets (which is enough even for quite complex applications) | ||
| + | * its implementation is available for many programming languages (of course, for Python too) | ||
| + | |||
| + | The module that brings Tk to the Python world is named TkInter, which is short for Tk Interface. It’s free and open, too. | ||
| + | |||
| + | You may have some trouble believing that you’ve been using TkInter for a long time, actually since your very first encounter with programming in Python. | ||
| + | |||
| + | Yes, it’s true – IDLE, the very first Python IDE, is written using TkInter. | ||
| + | |||
| + | We think this is the best recommendation – don’t you? | ||
| + | |||
| + | |||