Cerca

Heus ací els resultats de la cerca.

Python Professional Course Series: GUI Programming
39 Resultats, Darrera modificació:
worry, it won’t take long. We’re going to travel not more than fifty years back. Are you ready? Okay,... to a computer (don’t forget that the Internet had not been invented yet) and was rarely placed in the ... what it was like to work with a computer without not being able to see a picture, not saying a word about movies or animations. No photographs, no selfi
1.6 Events and how to handle them
34 Resultats, Darrera modificació:
ring the proper reactions to the user’s actions. Now it’s time to show you some details of the events... ow you control the event manager’s behavior. For now, however, we want you to focus your attention on... re going to display a whole encyclopedia volume); note: you can use the ''\n'' digraph to visually bre... troy) button_2.pack() window.mainloop() </code> Note the ''\n'' embedded inside the info string. An
1.2 Let TkInter speak!
32 Resultats, Darrera modificació:
as a whole: <code python>import tkinter</code> Note: it won’t allow you to access some modules buil... ll have to import them separately. As you already now, such an import will force you to use the qualif... port tkinter as tk</code> Okay, we know there’s no accounting for taste, but it’s definitely worth a... fe on the edge, you can simplify your import (but not the rest of your work) by using the star as a co
2.3 A small lexicon of widgets - Part 3
29 Resultats, Darrera modificació:
t of cooperating widgets**. The ''Entry'' widget not only presents a line of text, but is also able t... python-pcpp1:m3:pasted:20231228-112558.png}} And now, some of ''Entry''’s methods: {{:info:cursos:pue... this state if its current contents are invalid. Note: we’ve had to use the ''focus_set()'' method, a... Try to modify the code to allow the user to enter not more than five digits. The last part of our sto
2.4 Shaping the main window and conversing with the user
22 Resultats, Darrera modificació:
**title**. The title is defaultly set to ''Tk'', no matter what your application is named, or even if... re’s one working solution, although we agree it’s not very elegant. Take a look at the code we've pro... conphoto(False, photo) window.mainloop() </code> Note: we’ve used the Python Institute’s logo as the ... e. If you want your main window to be sized in a non-default way, you have to use a low-level method
1.5 A simple GUI application
20 Resultats, Darrera modificació:
cation == Building a GUI application from scratch Now we're going to build a very simple and rather us... op() </code> Our window looks like this one for now: {{ :info:cursos:pue:python-pcpp1:m3:pasted:20231223-110745.png }} There's nothing surprising yet. Let's add something to this ... ray area. Our new friend is called ''Label'' – a non-clickable widget able to **present short textual
1.3 Settling widgets in the window's interior
19 Resultats, Darrera modificació:
us to show you some ways of putting the widgets (not only the buttons) inside windows. There are more... r each widget. Unfortunately, its assumptions may not live up to your expectations, and the final resu... nd tries to deploy the widgets according to them. Note the word general – they aren't as precise as th... ager demands the usage of the ''place()'' method. Note: the method is invoked **from within the widget
1.8 Interacting with widget methods
14 Resultats, Darrera modificació:
ve **methods** – you’ve met some of them already. Now we’re going to show you a few more of them, and ... manager **will invoke the function** (only once); note: this the only possible way of controlling the ... ntified by the **id** argument. Seems confusing? Not at all. The example will shed more light on it t... else: color = 'white' is_white = not is_white frame.config(bg=color) frame.af
1.7 Visiting widgets’ properties
10 Resultats, Darrera modificació:
usable widget properties. A widget's property is not just an **object property**. Although every widg... t, you can access its properties by using the dot notation. You have to use one of two possible ways o... 50, y=100, width=100) window.mainloop() </code> Note: we use the text property to: * **diagnose** ... piece of text (e.g., ''Button'' and ''Label'' but not ''Frame'') can be made to use a font **different
2.1 A small lexicon of widgets - Part 1
10 Resultats, Darrera modificació:
of widgets - Part 1 == A small lexicon of widgets Now we’re ready to present a systematized set of som... ets fall into two categories: **clickable** and **non-clickable**. We’ll start with the first. We thi... == tk.DISABLED: button_1.config(state=tk.NORMAL) button_1.flash() else: b... wo-state** switch that can be ticked (checked) or not; thus, it is a handy tool to represent yes/no us
1.4 Coloring your widgets
8 Resultats, Darrera modificació:
ellow") button.pack() window.mainloop() </code> Note the two new arguments we use in the constructor... ** or even **grey**. It's easy and handy although not very precise. Tkinter can do something more for... r's presence (saturation 255). Do you think it's not too much? Maybe, but don't forget that you mix t... n-pcpp1:m3:pasted:20231223-110114.png }} Setting non-zero values for more than one component produces
2.2 A small lexicon of widgets - Part 2
6 Resultats, Darrera modificació:
= 2.2 A small lexicon of widgets - Part 2 == Non-clickable widgets The next four widgets fall into the **non-clickable** category. They’re designed to presen... asted:20231228-111139.png}} The Label widget has no usable methods – sorry! The sample in the editor... on relative to the Frame’s **upper-left corner**, not the window’s one. It also means that if you move
1.9 Looking at variables
4 Resultats, Darrera modificació:
n’t change your mind during the variable’s life. Note: you can only create an observable variable **a... proper constructor and save the returned object. Note: the newly created variables are set to: * in... ringVar'' kind: <code python> strng.set("To be or not to be") </code> If you need to **use the value**... the variable’s life. The number of observers is not limited. Adding an observer to a variable is do
2.5 Working with the Canvas
1 Resultats, Darrera modificació:
new adventure. This will require neither palette nor easel – ''Canvas'' brings you all you need. Let