el

Cerca

Heus ací els resultats de la cerca.

2.3 A small lexicon of widgets - Part 3
39 Resultats, Darrera modificació:
plication, you have to: * **create** a top-level menu object; * **embed** it inside the window... ile = tk.Menu(main_menu) main_menu.add_cascade(label="File", menu=sub_menu_file) # 2nd main menu item... elp = tk.Menu(main_menu) main_menu.add_command(label="About...", command=about_app) window.mainloop()... ng the hotkey to "Alt-F" main_menu.add_cascade(label="File", menu=sub_menu_file, underline=0) sub_menu
1.5 A simple GUI application
30 Resultats, Darrera modificació:
is dull gray area. Our new friend is called ''Label'' – a non-clickable widget able to **present shor... ython> import tkinter as tk window = tk.Tk() label = tk.Label(window, text = "Little label:") label.pack() window.mainloop() </code> As you can see, we're using
1.6 Events and how to handle them
30 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... ("Click!","I love clicks!") window = tk.Tk() label = tk.Label(window, text="Label") label.pack() button = tk.Button(window, text="Button", command=clic
1.7 Visiting widgets’ properties
22 Resultats, Darrera modificació:
enting a piece of text (e.g., ''Button'' and ''Label'' but not ''Frame'') can be made to use a font **... obviously – named ''font''. We’ve used the ''Label'' widget to demonstrate three different fonts. Lo... ython> import tkinter as tk window = tk.Tk() label_1 = tk.Label(window, text="Quick brown fox jumps over the lazy dog") label_1.grid(column=0, row=0) la
2.2 A small lexicon of widgets - Part 2
19 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
2.4 Shaping the main window and conversing with the user
11 Resultats, Darrera modificació:
y invokes one of the ''tkinter'' internal, low-level mechanisms directly communicating with the OS’s w... tute’s logo as the application icon (logo.png). Feel free to replace it with whatever you choose. If ... ed in a non-default way, you have to use a low-level method named ''geometry()'', whose only argument ... he window’s closing button), you can use a low-level ''tkinter'' method named ''protocol()'' in the fo
1.4 Coloring your widgets
6 Resultats, Darrera modificació:
ww.tcl.tk/man/tcl8.4/TkCmd/colors.html|here]]. Feel free to use them – we've showed our try in the ed... menon is utilized by the so-called **RGB color model** which is one of the additive color models and i... r displays of different kinds. One of the RGB model implementations allows you to set the **saturatio... uish about 7 million colors, consequently, the model should work well and it really does. Let's take
1.3 Settling widgets in the window's interior
4 Resultats, Darrera modificació:
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... matically; * ''x=x'' – the widget's top-left pixel's **horizontal coordinate** measured relative to ... ft corner; * ''y=y'' – the widget's top-left pixel's **vertical coordinate** measured relative to th
Python Professional Course Series: GUI Programming
3 Resultats, Darrera modificació:
n’t worry, it won’t take long. We’re going to travel not more than fifty years back. Are you ready? Ok... Now it’s time for the second part of our time travel adventure. Are you ready? There are more disadva... n-clickable member of the window's team is a **label** – a piece of text inside a window which literal
1.8 Interacting with widget methods
3 Resultats, Darrera modificació:
Widget.after(time_ms, function) Widget.after_cancel(id) </code> * ''after()'' – this method expects... hich is done with a method named… * ''after_cancel(id)'' – the method cancels the planned invocation... wo buttons and uses the ''after()'' method to propel the process. <code python> import tkinter as tk
1.2 Let TkInter speak!
2 Resultats, Darrera modificació:
he widget's coordinates refer defaultly to the pixel occupied by the upper-left corner; * the widget... d:20231222-033805.png }} * This means that a pixel described as **(x=10,y=10)** is located near the
2.5 Working with the Canvas
2 Resultats, Darrera modificació:
enture. This will require neither palette nor easel – ''Canvas'' brings you all you need. Let’s star... ow.mainloop() </code> It creates a 400 x 400-pixel **canvas** with a **yellow** background. Next, it
1.9 Looking at variables
1 Resultats, Darrera modificació:
le’s annihilation (removing the object through ''del'') * a reference to a function which will be in