Cerca
Heus ací els resultats de la cerca.
Resultats de text complet:
- 2.4 Shaping the main window and conversing with the user
- nnamed. To change the window’s title, you would use a method named ''title()''. Our sample code show... e directory where the application resides; * **use** a ''PhotoImage'' class constructor to convert t... toImage(file = 'logo.png') window.wm_iconphoto(False, photo) window.mainloop() </code> Note: we’ve us... g). Feel free to replace it with whatever you choose. If you want your main window to be sized in a n
- Python Professional Course Series: GUI Programming
- = Python Professional Course Series: GUI Programming == What is GUI? GUI is an acronym. Moreover, it’s... Okay, that’s enough jokes about TLA’s for one course, all the more that GUI is present nearly everywhe... en washing machine or heating controller – all these things have a screen, most of them colored and many (more and more every year) use it to display a GUI and to communicate with the u
- 1.6 Events and how to handle them
- us your attention on a very helpful method we’ll use to arrange communication between you and your application. Of course, you can use the regular ''print()'' function to show messages and present a debug trace. The output ... n to behave in a mature way. The function we’ll use for our experiments is named ''showinfo()'', it c
- 1.2 Let TkInter speak!
- ou already now, such an import will force you to use the qualified names of tkinter’s components. If ... e to write long package names each time you make use of their contents, you can perform an import whic... med **mainloop()**. The name is significant because – as you can see – there is nothing more you can ... h the window, and the most important is how to close it while also causing the application to quit. Cu
- 2.3 A small lexicon of widgets - Part 3
- ur sample program in the editor shows you how to use an **observable variable** along with the **trace... urrent contents are invalid. Note: we’ve had to use the ''focus_set()'' method, as the widget doesn’t... tent is valid. last_string = string else: text.set(last_string) last_string = ''... n referred to as **items** or **entries**; * these options can have **hot-keys** (keyboard shortcuts
- 2.5 Working with the Canvas
- th drawings, text, frames, and other widgets. Please treat this story as a basic introduction to the '... react to many events – we hope you’ll explore these issues on your own while we show you how to start... find the parts of the code responsible for all these actions? {{:info:cursos:pue:python-pcpp1:m3:past... tructs. To create a polygonal chain, you need to use the one named ''create_line()'': <code python> ca
- 1.4 Coloring your widgets
- ''tkinter'', in other words, what means can you use to order the button to be red or blue. There are... he example of ''Button'' but don't forget that these ways are universal and can be used virtually ever... inloop() </code> Note the two new arguments we use in the constructor invocation: ''bg'' (what is a ... line of least resistance here – we've just made use of regular English names of colors and packed the
- 1.3 Settling widgets in the window's interior
- learned about in the previous section. To be precise, there are **three different methods**. These methods are implemented by **geometry managers**. ''P... them. Note the word general – they aren't as precise as the ones used by place, but are far more detailed than those utilized by ''pack''. There is one very importan
- 1.7 Visiting widgets’ properties
- roperties by using the dot notation. You have to use one of two possible ways of reading and setting w... if state == "ON": state = "OFF" else: state = "ON" button["text"] = state ... width=100) window.mainloop() </code> Note: we use the text property to: * **diagnose** the current button’s state; * **change** the button’s state
- 1.5 A simple GUI application
- 're using the ''pack()'' geometry manager to compose the window. Let's welcome Label into our window:... integer** values. "Okay," you may say, "can't we use a regular variable instead?" **No, we can't.** O... h an object to store an integer value, you can't use the assignment operator. The class offers a dedicated method for that purpose, and the method is named ''set()''. Note: we've
- 1.8 Interacting with widget methods
- to be very specific. We can even say that the sense of their existence is very closely bound to the u... hen using an event-driven environment.\\Why? Because you can’t just invoke the built-in ''sleep()'' fu... te if is_white: color = 'black' else: color = 'white' is_white = not is_wh... is – who invokes it? The event managers do, because: * we initially encourage it to make the invoc
- 2.1 A small lexicon of widgets - Part 1
- ibe all of them, however – it would bloat our course to an unmanageable size. We’re convinced that our... sts. You already know some of the widgets. In these cases, we’ll limit our descriptions to the necess... nts that configure the widget. Different widgets use different sets of arguments. As we mentioned bef... g(state=tk.NORMAL) button_1.flash() else: button_1.flash() button_1.config
- 1.9 Looking at variables
- al agents. For example, the ''Entry'' widget can use its own observable variable to inform other objec... ed**. There is another important difference – these variables are **typed**. You have to be aware of ... also the constructors’ names, so if you want to use any of the variables, you must invoke the proper ... float ''0.0'' for ''DoubleVar''; * Boolean ''False'' for ''BooleanVar''; * string ''""'' for ''Str
- 2.2 A small lexicon of widgets - Part 2
- ’t have a ''command'' property, although you can use ''bind()'' to simulate similar behavior. The ''L... e #2", labelanchor='se', width=200, height=100, bg='yellow') button_1_1