Cerca

Heus ací els resultats de la cerca.

2.3 A small lexicon of widgets - Part 3
68 Resultats, Darrera modificació:
art 3 There are two remaining widgets we want to tell you about – the first one is just a widget, whil... operations like inserting, removing, scrolling, selecting, copying and pasting, etc.. We’ll show you... es of the widget, as it’s full equipment is extremely complex. Fortunately, we don’t need its entire flexibility when we just want to enter and validate a
Python Professional Course Series: GUI Programming
54 Resultats, Darrera modificació:
’s a three-letter acronym, a representative of a well-known class of acronyms which plays a very impor... ce is graphical? We have to do a little time traveling to understand that. Don’t worry, it won’t take long. We’re going to travel not more than fifty years back. Are you ready? Ok... uter, you needed to have a specialized and completely separate device called a **terminal**. The termi
1.5 A simple GUI application
50 Resultats, Darrera modificació:
w we're going to build a very simple and rather useless GUI application. Does that sound weird? Maybe,... abulous goal will look like the vision presented below: {{ :info:cursos:pue:python-pcpp1:m3:pasted:202... t an exception. We'll start with something absolutely **obvious** – we'll construct a window and launc... is dull gray area. Our new friend is called ''Label'' – a non-clickable widget able to **present shor
1.6 Events and how to handle them
50 Resultats, Darrera modificació:
nt handling As you already know, events are the fuel which propel the application’s movements. All events come **to the event manager**, which is responsi... r, we want you to focus your attention on a very helpful method we’ll use to arrange communication bet... ndow. It’s okay if used in the early stages of development, but it’s very inelegant if you want the ap
1.7 Visiting widgets’ properties
37 Resultats, Darrera modificació:
] if state == "ON": state = "OFF" else: state = "ON" button["text"] = stat... ode and observe its behavior. The second method relies on two specialized widget methods, the first n... ) if state == "ON": state = "OFF" else: state = "ON" button.config(text=st... vious snippet. One of the properties we want to tell you about is ''font''. Every widget presenting a
2.2 A small lexicon of widgets - Part 2
31 Resultats, Darrera modificació:
'bind()'' to simulate similar behavior. The ''Label'' widget displays some lines of text inside the window: <code python> label = Label(master, option, ...) </code> The ''Label'' widget contains two usable properties, but you need to re
1.3 Settling widgets in the window's interior
25 Resultats, Darrera modificació:
s the most detailed one. It forces you to **precisely declare a widget's location**, pixel by pixel. It won't, however, protect you from some common mistakes causing the widgets to overlap eac... nd the best location** for each widget. Unfortunately, its assumptions may not live up to your expecta
1.2 Let TkInter speak!
24 Resultats, Darrera modificació:
o build GUI applications. The GUI application itself consists of four essential elements: * **importing** the needed **tkinter** components; * **cre... age and you will still have to import them separately. As you already now, such an import will force y... rm an import which **renames** the package (precisely: which creates an **alias** of its original name
2.4 Shaping the main window and conversing with the user
22 Resultats, Darrera modificació:
working solution, although we agree it’s not very elegant. Take a look at the code we've provided in ... y invokes one of the ''tkinter'' internal, low-level mechanisms directly communicating with the OS’s w... )'' is a part of ''tkinter'', and we’re going to tell you more about it soon) <code python> import tk... tute’s logo as the application icon (logo.png). Feel free to replace it with whatever you choose. If
1.4 Coloring your widgets
19 Resultats, Darrera modificació:
ed properties to handle their colors and we will tell you about them while discussing the widgets themselves. Currently, the most important thing is gettin... ree methods designed to meet your needs. We will tell you about them on the example of ''Button'' but ... k.Button(window, text="Button #1", bg="red", fg="yellow") button.pack() window.mainloop() </code> No
1.8 Interacting with widget methods
18 Resultats, Darrera modificació:
say that the sense of their existence is very closely bound to the unique features of **event programm... Widget.after(time_ms, function) Widget.after_cancel(id) </code> * ''after()'' – this method expects... change its plans; when the number of milliseconds elapses, the manager **will invoke the function** (o... rns a value which is as specific as the method itself – it’s a unique **id** of the planned invocation
2.5 Working with the Canvas
18 Resultats, Darrera modificació:
much more for you – for example, it can scroll itself and react to many events – we hope you’ll explor... enture. This will require neither palette nor easel – ''Canvas'' brings you all you need. Let’s star... s = tk.Canvas(window, width=400, height=400, bg='yellow') canvas.create_line(10, 380, 200, 10, 380, 38... ow.mainloop() </code> It creates a 400 x 400-pixel **canvas** with a **yellow** background. Next, it
2.1 A small lexicon of widgets - Part 1
9 Resultats, Darrera modificació:
most cases, but can be also a ''Frame'' or a ''LabelFrame'' (described in the next section). The cons... ike and how it works, so we’re going to limit ourselves to enumerating the most usable properties of t... fig(state=tk.NORMAL) button_1.flash() else: button_1.flash() button_1.conf... widgets – as only one of them can be **mutually selected** (checked), it’s a good tool to represent /
1.9 Looking at variables
6 Resultats, Darrera modificació:
rm other objects that the contents of the input field have been changed. From a technical point of vi... le’s annihilation (removing the object through ''del'') * a reference to a function which will be in... he observer is done with a method named ''trace_vdelete()'': <code python> variable.trace_vdelete(trace_mode,obsid) </code> Its arguments’ meanings are a