Cerca
Heus ací els resultats de la cerca.
Resultats de text complet:
- 1.2 Let TkInter speak!
- Inter is a package named **tkinter**. The package contains a bunch of functions, constants, classes, objects, and modules used to build GUI applications. The GUI application itself consists of four essential elements: * **importing... gets** to the window; * **launching** the event controller. That’s all. Really. Looks too good to be
- Python Professional Course Series: GUI Programming
- et, fridge, oven, even washing machine or heating controller – all these things have a screen, most of ... Okay,” you may say, “nice image, but how could we control such a computer?” To control the computer, you needed to have a specialized and completely separa... building, a different city or even on a different continent. But the most intriguing part of the story
- 2.3 A small lexicon of widgets - Part 3
- = 2.3 A small lexicon of widgets - Part 3 There are two remaining widgets we want to tell you about – the first one is just a widget, while the second is, in fact, a **set of cooperating widgets**. ... d restores the field to this state if its current contents are invalid. Note: we’ve had to use the ''f... if string == '' or string.isdigit(): # Field's content is valid. last_string = string el
- 2.4 Shaping the main window and conversing with the user
- = 2.4 Shaping the main window and conversing with the user The main window is a very specific construct, as its fate is shared among **two** master... .mainloop() </code> Changing the main window’s icon is more troublesome if you want to do in a portab... rt tkinter as tk window = tk.Tk() window.title('Icon?') window.tk.call('wm', 'iconphoto', window._w, P
- 1.6 Events and how to handle them
- e able to influence a widget’s state, and how you control the event manager’s behavior. For now, howev... ce. The output will appear in the standard Python console, without affecting the application window. It... nd the box will be **untitled** then; * the **second** string is a message to display inside the box;... } If your widget is a **clickable** one, you can connect a callback to it using its ''command'' proper
- 1.7 Visiting widgets’ properties
- s state; * **change** the button’s state to the contrary one; * **update** the button’s title. Run the code and observe its behavior. The second method relies on two specialized widget methods,... igned to **read** the property’s value, and the second named ''config()'', which allows you to **set** a new value to the property. This is what they look
- 1.8 Interacting with widget methods
- ime interval specification** (expressed in milliseconds: 1 s = 1000 ms) and the second **points to an existing function**; successful invocation of the meth... er to change its plans; when the number of milliseconds elapses, the manager **will invoke the function... (only once); note: this the only possible way of controlling the **passage of time** when using an eve
- 2.1 A small lexicon of widgets - Part 1
- = 2.1 A small lexicon of widgets - Part 1 == A small lexicon of widgets Now we’re ready to present a systematized set of som... d bloat our course to an unmanageable size. We’re convinced that our collection is large enough to make... nimum. Each ''tkinter'' widget is created by a **constructor** of its class. The very first argument o
- 1.5 A simple GUI application
- e accustomed to some ''tkinter'' **habits** and **conventions**. Our fabulous goal will look like the ... art with something absolutely **obvious** – we'll construct a window and launch an event controller – look at the code in the editor to see how to do it. <... ort textual information**, passed to the widget's constructor using a ''text'' argument. The text can l
- 2.2 A small lexicon of widgets - Part 2
- = 2.2 A small lexicon of widgets - Part 2 == Non-clickable widgets The next four widgets fall into the ... aster, option, ...) </code> The ''Label'' widget contains two usable properties, but you need to remem... panied by an observable variable can be used to **continuously** update the ''Label''’s contents. <code python> import tkinter as tk def to_string(x):
- 2.5 Working with the Canvas
- t draws a line (precisely: a polygonal **chain**) consisting of three line segments. The application ca... w you how to create a canvas. This is done with a constructor named Canvas(). <code python> c = Canvas... of methods designed to create different graphical constructs. To create a polygonal chain, you need to ... yn, option...) </code> The method draws a line connecting the points of specified coordinates (xi,yi
- 1.3 Settling widgets in the window's interior
- loy the widgets manually and worry about possible conflicts and failures, you may entrust the whole pro... w it belongs to (it gets the information from the constructor's very first argument). The most usable ... As you can see, using ''place()'' gives you full control over the window's image. There is only one important but — full control means full responsibility. Sometimes it's bet
- 1.4 Coloring your widgets
- </code> Note the two new arguments we use in the constructor invocation: ''bg'' (what is a short form ... There two additional parameters describing the second set of colors named ''activeforeground'' and ''activebackground'' respectively used by the event controller when the button is **pressed**. Do you wan... called **color components**) so the full spectrum consists of 256*256*256 = 16,777,216 colors. An avera
- 1.9 Looking at variables
- ervable variable to inform other objects that the contents of the input field have been changed. From ... nt of view, such a variable is an object of the **container class**. This means that a variable of that... Var * StringVar The names you see are also the constructors’ names, so if you want to use any of the variables, you must invoke the proper constructor and save the returned object. Note: the