Cerca

Heus ací els resultats de la cerca.

2.4 Shaping the main window and conversing with the user
15 Resultats, Darrera modificació:
r you choose. If you want your main window to be sized in a non-default way, you have to use a low-le... o use it. Look – clicking the window changes its size, and the window gets bigger and smaller periodi... port tkinter as tk def click(*args): global size, grows if grows: size += 50 if size >= 500: grows = False else:
1.2 Let TkInter speak!
11 Resultats, Darrera modificació:
ow it works. We’ll do it step-by-step. Ready The simplest (and at the same time the less controllable... an enthusiast of living life on the edge, you can simplify your import (but not the rest of your work)... ndow's method, named **mainloop()**. The name is significant because – as you can see – there is noth... cupied by the upper-left corner; * the widget's size is defaultly determined by the constructor in o
Python Professional Course Series: GUI Programming
9 Resultats, Darrera modificació:
to different screen areas and acted in a way very similar to a mouse. But believe us – you don't want... swer was given by pressing a set of allowed keys. Simple? Simple. From our present-day developer's perspective, too simple. From a user's point of view, difficult and i
1.3 Settling widgets in the window's interior
8 Resultats, Darrera modificació:
parameter defaults to 1 (the widget won't cross a single grid's cell) * ''rowspan=rs'' – works as co... d extent by using the following parameters: * ''side=s'' – forces the manager to pack the widgets in... et about ''pack()'' and use either ''grid() ''(in simpler cases) or ''place()''. Let ''pack()'' show ... loop() </code> As you can see, using ''pack()'' simplifies the code – you don't need to specify any
1.7 Visiting widgets’ properties
8 Resultats, Darrera modificació:
nts as **tuples**. Surprised? Don’t be, it’s very simple. Any font can be described as two- or three-... tuples: <code python> ("font_family_name", "font_size") ("font_family_name", "font_size", "font_style") </code> * the two-element tuple contains two ... mily name**, and the second carrying the **font’s size** measured in points; note: the second element
2.3 A small lexicon of widgets - Part 3
7 Resultats, Darrera modificació:
er **only digits** – all other characters will be silently **ignored**. The tracer is invoked each ti... menus (this is called a **cascade**) or connect a single callback. We’ll show you the whole process st... ur steps are as follows: * line 5: we define a simple callback which displays the About dialog; *... le", menu=sub_menu_file) # 2nd main menu item: a simple callback sub_menu_help = tk.Menu(main_menu) m
1.5 A simple GUI application
6 Resultats, Darrera modificació:
= 1.5 A simple GUI application == Building a GUI application from scratch Now we're going to build a very simple and rather useless GUI application. Does that... .png }} Note: ''pack()'' resizes the window to a size large enough to fit all the packed widgets. Thi... </code> Entry is designed to let the user enter simple, one-line data, like single numbers, names, a
2.2 A small lexicon of widgets - Part 2
4 Resultats, Darrera modificació:
nd'' property, although you can use ''bind()'' to simulate similar behavior. The ''Label'' widget displays some lines of text inside the window: <code py... inloop() </code> The ''Message'' widget is very similar to the ''Label'' (among other things, it has... text by fitting it automatically to the widget’s size. <code python> message = Message(master, optio
1.8 Interacting with widget methods
3 Resultats, Darrera modificació:
strate how the ''after()'' method works is rather simple (yes, absolutely; don’t you think so, too?). ... removes the widget completely, not only from your sight, but also from the event manager’s memory, as ... ok at the code we've provided in the editor. This simple sample application shows how the focus can be
2.1 A small lexicon of widgets - Part 1
2 Resultats, Darrera modificació:
er – it would bloat our course to an unmanageable size. We’re convinced that our collection is large e... here. Note: there is no ''toggle()'' method as a single ''Radiobutton'' performs such an operation.
2.5 Working with the Canvas
2 Resultats, Darrera modificació:
as'' brings you all you need. Let’s start with a simple example. Take a look at the code. <code pyt... loop() </code> Drawing a **polygon** looks very similar to drawing a line, with the difference being
1.4 Coloring your widgets
1 Resultats, Darrera modificació:
n't bother if you want some of your widgets to be simply **white**, **black**, **green**, **gray** or
1.6 Events and how to handle them
1 Resultats, Darrera modificació:
ssibilities. In the editor we've provided a very simple code demonstrating how ''showinfo()'' works:
1.9 Looking at variables
1 Resultats, Darrera modificació:
revious ''trace()'' invocation. We’ve prepared a simple snippet showing how the observable variables