in

Cerca

Heus ací els resultats de la cerca.

2.3 A small lexicon of widgets - Part 3
75 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... submenu) * if you want to have such a menu within your Tkinter application, you have to: * **cr... ck which displays the About dialog; * line 9: main window creation (nothing special at all) * line
Python Professional Course Series: GUI Programming
30 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!
30 Resultats, Darrera modificació:
* components; * **creating** an application’s main window; * adding a set of necessary **widgets**... : it won’t allow you to access some modules built-in within the package and you will still have to import them separately. As you already now, such an imp... – it's only a very first step. Look at the code in the editor. <code python> import tkinter skylig
2.4 Shaping the main window and conversing with the user
29 Resultats, Darrera modificació:
= 2.4 Shaping the main window and conversing with the user The main window is a very specific construct, as its fate is shar... S must be **aware** of anything you do with the main window. The first main window property that you may want to change is its **title**. The title is de
1.3 Settling widgets in the window's interior
28 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
1.6 Events and how to handle them
28 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.5 A simple GUI application
19 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... :20231223-111112.png }} Make our window great again. Now we invite a ''Button'' to join our team. Our ''Button'' will be completely **mute**, as we hav
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
2.5 Working with the Canvas
15 Resultats, Darrera modificació:
ext, it draws a line (precisely: a polygonal **chain**) consisting of three line segments. The applica... nt graphical constructs. To create a polygonal chain, you need to use the one named ''create_line()'':... 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
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
2.2 A small lexicon of widgets - Part 2
10 Resultats, Darrera modificació:
widget has no usable methods – sorry! The sample in the editor shows how the ''textvariable'' accompa... <code python> import tkinter as tk def do_it_again(): text.set(text.get() + "and again...") window = tk.Tk() button = tk.Button(window, text="Go ahead!", command=do_it_again) button.pack() text = tk.StringVar() message = tk
1.8 Interacting with widget methods
9 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 – it would **freeze** your application for the whol... lutely; don’t you think so, too?). You can see it in the editor window. There’s a function named ''bl
1.9 Looking at variables
9 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... only create an observable variable **after the main window initialization**. Don’t forget this – you’... 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
2.1 A small lexicon of widgets - Part 1
9 Resultats, Darrera modificació:
and tests. You already know some of the widgets. In these cases, we’ll limit our descriptions to the ... n, ... ) </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