Diferències

Ací es mostren les diferències entre la revisió seleccionada i la versió actual de la pàgina.

Enllaç a la visualització de la comparació

Ambdós costats versió prèvia Revisió prèvia
info:cursos:pue:python-pcpp1:m3:1.1 [22/12/2023 02:14] mateinfo: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, discovering, and serving. Here are some of them:
 +
 +  * 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, each operating system delivers its own set of services designed to operate with its native GUI. Moreover, some of them (e.g., Linux) may define more than one standard for visual programming (two of the most widespread in the U*x world are named GTK and Qt).
 +
 +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, to write one code and not worry about portability.
 +
 +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?
 +
 +
  • info/cursos/pue/python-pcpp1/m3/1.1.1703240040.txt.gz
  • Darrera modificació: 22/12/2023 02:14
  • per mate