Cerca

Heus ací els resultats de la cerca.

1.6 Events and how to handle them
16 Resultats, Darrera modificació:
now, however, we want you to focus your attention on a very helpful method we’ll use to arrange commun... on to **title the message box** which will appear on the screen; you can use an **empty** string, and ... vent is actually an object. Let’s shed some light on that. An event object is an instantiation of the... ind the callback again**. We haven’t said a word on modifying a widget’s properties, and we’re going
Python Professional Course Series: GUI Programming
15 Resultats, Darrera modificació:
in a different building, a different city or even on a different continent. But the most intriguing p... t could display either grey, amber, or green dots on a black or nearly black background); * wasn’t a... al terminals which exerted the greatest influence on the construction of such equipment and became wor... ality, but it's not just a matter of what you see on the screen, but also what you can do to change it
1.7 Visiting widgets’ properties
13 Resultats, Darrera modificació:
et properties’ values. The first method is based on using a **dictionary** which exists inside every ... editor. <code python> import tkinter as tk def on_off(): global button state = button["text"] if state == "ON": state = "OFF" else: state = "ON" button["text"] = state window = tk.Tk() bu
2.3 A small lexicon of widgets - Part 3
4 Resultats, Darrera modificació:
ly, hot-keys are triggered by pressing Alt-hotkey on the keyboard) * **selecting a menu’s option** (... pearance.<code python> import tkinter as tk def on_off(): global accessible if accessible ==... Menu", menu=sub_menu) sub_menu.add_command(label="On/Off", command=on_off) sub_menu.add_command(label="Switch", state=tk.DISABLED) window.mainloop() </co
1.2 Let TkInter speak!
3 Resultats, Darrera modificació:
on</code> If you're an enthusiast of living life on the edge, you can simplify your import (but not t... ow it's the turn of the button. A button visible on the screen is, in fact, a reflection of an object... has clicked the confirming button (note: the text on the button depends of the OS international settin
1.4 Coloring your widgets
3 Resultats, Darrera modificació:
d to meet your needs. We will tell you about them on the example of ''Button'' but don't forget that t... 5209.png }} We encourage to you make some clicks on the **button** – it will unveil its little secret... tely does: The third method you can use is based on the fact that each color can be obtained by **mix
2.4 Shaping the main window and conversing with the user
3 Resultats, Darrera modificació:
ow, you can usually change the main window’s size on your own by **dragging the window’s bottom-right ... ult** (pre-focused) answer; usually, it’s focused on the button located first from the left; this can ... k() button = tk.Button(window, text="What's going on?", command=question) button.pack() window.mainloo
2.5 Working with the Canvas
3 Resultats, Darrera modificació:
many events – we hope you’ll explore these issues on your own while we show you how to start your new ... </code> The ''create_text()'' method puts text on the ''Canvas''. The text is placed inside a recta... create_image()'' method draws an image (a bitmap) on the Canvas. The image is placed inside a rectangl
1.3 Settling widgets in the window's interior
2 Resultats, Darrera modificació:
e rows and three columns. The buttons are settled on the **grid's diagonal**. Now we’re going to affe... remely surprising, and you should spend some time on your own experimenting with all its vices. We su
1.5 A simple GUI application
2 Resultats, Darrera modificació:
can be in one of two possible states: * the **ON** state when the ''Checkbutton'' is checked/ticke... e ''Checkbutton'' will be checked when it appears on the screen. Let's check it. This is what our wi
1.8 Interacting with widget methods
2 Resultats, Darrera modificació:
ing? Not at all. The example will shed more light on it than telling you a long and winding story. <c... ound color from white to black and back depending on the state of the ''is_white'' variable. Easy. No
2.2 A small lexicon of widgets - Part 2
2 Resultats, Darrera modificació:
dow = tk.Tk() button = tk.Button(window, text="Go on!", command=plus) button.pack() text = tk.StringVa... title may be located at one of 12 possible places on the border line. <code python> lfrm = LabelFrame