Cerca
Heus ací els resultats de la cerca.
Resultats de text complet:
- 2.3 A small lexicon of widgets - Part 3
- about – the first one is just a widget, while the second is, in fact, a **set of cooperating widgets**. The ''Entry'' widget not only presents a line of ... t operations like inserting, removing, scrolling, selecting, copying and pasting, etc.. We’ll show yo... are invalid. Note: we’ve had to use the ''focus_set()'' method, as the widget doesn’t take the focus
- Python Professional Course Series: GUI Programming
- = Python Professional Course Series: GUI Programming == What is GUI? GUI is an acronym. Moreover, it’s... esent nearly everywhere. Look around you – you’ll see a couple of different devices equipped with screens: phone, tablet, computer, TV set, fridge, oven, even washing machine or heating c... r Interface. In this three-word acronym, the User seems to be the most obvious part. The word Interfac
- 1.5 A simple GUI application
- nt controller – look at the code in the editor to see how to do it. <code python> import tkinter as t... el.pack() window.mainloop() </code> As you can see, we're using the ''pack()'' geometry manager to ... ckable component used to **group widgets** and to separate them (visually) from other window component... tton.pack(fill=tk.X) switch = tk.IntVar() switch.set(1) window.mainloop() </code> It's the switch
- 1.7 Visiting widgets’ properties
- roperties As you already know, every widget has a set of properties, and the widget’s user is able to ... how to manipulate properties and present a basic set of the most usable widget properties. A widget'... ve to use one of two possible ways of reading and setting widget properties’ values. The first method... ''prop'' and you want to read its value and then set it with a new value, you can do this in the foll
- 1.2 Let TkInter speak!
- ting** an application’s main window; * adding a set of necessary **widgets** to the window; * **la... he package and you will still have to import them separately. As you already now, such an import will ... ly itemized** by importing each of the facilities separately – just like this: <code python>from tkint... **. The name is significant because – as you can see – there is nothing more you can do in your code.
- 1.4 Coloring your widgets
- cks on the **button** – it will unveil its little secret. Can you see? The colors of the lowered (pressed) button are **gray** still. Why? Because ''fb'... y. There two additional parameters describing the second set of colors named ''activeforeground'' and ''activebackground'' respectively used by the event
- 1.3 Settling widgets in the window's interior
- = 1.3 Settling widgets in the window's interior == Settling widgets A familiarity with the ''Button'' widget a... lace()'', which you learned about in the previous section. To be precise, there are **three different ... esult can be really disappointing. This method of settling widgets is implemented by the ''pack'' geom
- 1.6 Events and how to handle them
- and the box will be **untitled** then; * the **second** string is a message to display inside the b... he ''\n'' digraph to visually break the info into separate lines. We’ll ask the ''showinfo()'' functi... d'' property, while the property can be initially set by the constructor invocation. We’ve already pr... to change our previous example a bit by making it sensitive to more than just one click. We've provid
- 1.9 Looking at variables
- DoubleVar * IntVar * StringVar The names you see are also the constructors’ names, so if you want... ed object. Note: the newly created variables are set to: * integer ''0'' for ''IntVar''; * float ... StringVar''. For example, if a widget is able to serve an observable variable of the string type, you... variable, you have to invoke its method, named ''set()'', and pass an argument to it. The argument sh
- 2.1 A small lexicon of widgets - Part 1
- widgets Now we’re ready to present a systematized set of some of the ''tkinter'' widgets. We aren’t ab... rame'' or a ''LabelFrame'' (described in the next section). The constructor accepts a set of arguments that configure the widget. Different widgets use different sets of arguments. As we mentioned before, all widg
- 2.5 Working with the Canvas
- : a polygonal **chain**) consisting of three line segments. The application can be terminated using th... rgument specifies the master widget (as usual). A set of keyword arguments specifies the properties of... 228-121919.png}} An existing ''Canvas'' offers a set of methods designed to create different graphica... ing at (x0,y0) and ending at (xn,yn) – as you can see, each pair of positional arguments describes one
- 1.8 Interacting with widget methods
- few more of them, and we’ll start with two which seem to be very specific. We can even say that the sense of their existence is very closely bound to the... expressed in milliseconds: 1 s = 1000 ms) and the second **points to an existing function**; successfu... ed invocation identified by the **id** argument. Seems confusing? Not at all. The example will shed m
- 2.4 Shaping the main window and conversing with the user
- o change is its **title**. The title is defaultly set to ''Tk'', no matter what your application is na... uments (you can use either of them, or both) with self-describing names: ''width'' and ''height''. Ru... oo large. Check the code in the editor window to see how it works. <code python> import tkinter as t... 'False'' – the user can’t change this dimension. Setting both arguments to ''False'' will stiffen you
- 2.2 A small lexicon of widgets - Part 2
- s(): global counter counter += 1 text.set(to_string(counter)) counter = 0 window = tk.Tk... k.Label(window, textvariable=text, height=4) text.set(to_string(counter)) label.pack() window.mainloop... mport tkinter as tk def do_it_again(): text.set(text.get() + "and again...") window = tk.Tk() ... essage(window, textvariable=text, width=400) text.set("You did it again... ") message.pack() window.ma