Cerca

Heus ací els resultats de la cerca.

1.3 Settling widgets in the window's interior
27 Resultats, Darrera modificació:
= 1.3 Settling widgets in the window's interior == Settling widgets A familiarity with the ''Button'' ... em than just ''place()'', which you learned about in the previous section. To be precise, there are **... ometry manager. The ''grid'' geometry manager is in the middle, in between the other two geometry managers. It gives you a chance to express your **gener
Python Professional Course Series: GUI Programming
26 Resultats, Darrera modificació:
ass of acronyms which plays a very important role in the IT industry. Okay, that’s enough jokes about ... onally. GUI stands for Graphical User Interface. In this three-word acronym, the User seems to be the... he word Interface needs some more reflection, but in fact, it is clear too – it’s a tool used by the u... bigger than the biggest refrigerator you ever had in your home) with thousands of colored lights, blin
1.2 Let TkInter speak!
19 Resultats, Darrera modificació:
: it won’t allow you to access some modules built-in within the package and you will still have to imp... – it's only a very first step. Look at the code in the editor. <code python> import tkinter skylig... created by the **tkinter** method named **Tk()**. In its most commonly used form, it needs no argument... as you can see – there is nothing more you can do in your code. Entering the controller's main loop **
2.4 Shaping the main window and conversing with the user
19 Resultats, Darrera modificació:
ndow’s icon is more troublesome if you want to do in a portable way. Here’s one working solution, alth... elegant. Take a look at the code we've provided in the editor. <code python> import tkinter as tk ... e** an icon as a PNG image; * **put** the image in the same directory where the application resides;... choose. If you want your main window to be sized in a non-default way, you have to use a low-level me
1.6 Events and how to handle them
18 Resultats, Darrera modificació:
and present a debug trace. The output will appear in the standard Python console, without affecting the application window. It’s okay if used in the early stages of development, but it’s very inelegant if you want the application to behave in a mature way. The function we’ll use for our exp... winfo()'' function to show us its possibilities. In the editor we've provided a very simple code demo
1.7 Visiting widgets’ properties
17 Resultats, Darrera modificació:
and then set it with a new value, you can do this in the following way: <code python> old_val = Widge... ] Widget["prop"] = new_val </code> Let’s see it in action. Look at the example we've provided in the editor. <code python> import tkinter as tk def o... g with the widget’s properties. Look at the code in the editor. <code python> import tkinter as tk
1.4 Coloring your widgets
12 Resultats, Darrera modificació:
g is getting to know how the colors are described in ''tkinter'', in other words, what means can you use to order the button to be red or blue. There are... kinter understands **English** – look at the code in the editor, our test is there. <code python> imp... oop() </code> Note the two new arguments we use in the constructor invocation: ''bg'' (what is a sho
1.5 A simple GUI application
11 Resultats, Darrera modificació:
t's start. As everyone knows, Rome wasn't built in a day, and our application isn't an exception. We... and launch an event controller – look at the code in the editor to see how to do it. <code python> im... nt is completely **invisible**. You won't find it in the window area. <code python> import tkinter as... arily used to represent **two-state selections**. In other words, it can be in one of two possible sta
2.3 A small lexicon of widgets - Part 3
11 Resultats, Darrera modificació:
first one is just a widget, while the second is, in fact, a **set of cooperating widgets**. The ''En... :pasted:20231228-112626.png}} Our sample program in the editor shows you how to use an **observable v... : and embed it into the main window (note the way in which the config() method is used and which prope... need it. We don’t even want to know how it worked in the past. Let’s get rid of it in a very simple w
2.5 Working with the Canvas
11 Resultats, Darrera modificació:
1:m3:pasted:20231228-122155.png}} Let’s see them in action. <code python> import tkinter as tk wind... </code> Look at the sample code we've provided in the editor. We’ve drawn the same chain, but we’ve... ed:20231228-122359.png}} Take a look at the code in the editor. This example’s effect is easy to pred... egment (connecting the first and the last points) in the chain is drawn **automatically** (you don’t n
1.9 Looking at variables
7 Resultats, Darrera modificació:
be aware of what type of value you want to store in them, and don’t change your mind during the varia... ble variable of the string type, you’ll create it in the following way: <code python> s = StringVar() ... ) </code> If you need to **use the value** stored in a variable, you have to use the variable method n... automatically each time a specified event occurs in the variable’s life. The number of observers is
2.1 A small lexicon of widgets - Part 1
7 Resultats, Darrera modificació:
and tests. You already know some of the widgets. In these cases, we’ll limit our descriptions to the ... /code> The master widget is just the main window in most cases, but can be also a ''Frame'' or a ''LabelFrame'' (described in the next section). The constructor accepts a set... d:20231228-105137.png}} Analyze and run the code in the editor – we wrote it to show you some of the
1.8 Interacting with widget methods
5 Resultats, Darrera modificació:
t is a **time interval specification** (expressed in milliseconds: 1 s = 1000 ms) and the second **poi... nt.\\Why? Because you can’t just invoke the built-in ''sleep()'' function within any of your callbacks... lutely; don’t you think so, too?). You can see it in the editor window. There’s a function named ''bl... top the whole application. You can use the method in a less devastating manner to get rid of unnecessa
2.2 A small lexicon of widgets - Part 2
5 Resultats, Darrera modificació:
widget has no usable methods – sorry! The sample in the editor shows how the ''textvariable'' accompa... 'tx'' variable updates. The ''Frame'' widget is, in fact, a ''container'' designed to store other wid... 20231228-111827.png}} Take a look at the example in the editor. <code python> import tkinter as tk ... f the ''Frame'' – it helps you arrange the window in the most convenient way. Pay attention to all fo