Cerca

Heus ací els resultats de la cerca.

Python Professional Course Series: GUI Programming
17 Resultats, Darrera modificació:
l the more that GUI is present nearly everywhere. Look around you – you’ll see a couple of different d... ng to understand that. Don’t worry, it won’t take long. We’re going to travel not more than fifty year... u ready? Okay, let’s go! == Terminals For a very long time (about 30 years or even longer) displays weren’t treated as a part of computers. A computer (s
1.2 Let TkInter speak!
17 Resultats, Darrera modificació:
hing** the event controller. That’s all. Really. Looks too good to be true? Let us show how it works.... tkinter’s components. If you don’t like to write long package names each time you make use of their c... its original name) at the time of import. **tk** looks shorter than **tkinter**, doesn’t it? <code p... life into it soon – it's only a very first step. Look at the code in the editor. <code python> impor
1.3 Settling widgets in the window's interior
16 Resultats, Darrera modificació:
. It forces you to **precisely declare a widget's location**, pixel by pixel. It won't, however, prote... y to guess your intentions and to **find the best location** for each widget. Unfortunately, its assum... ike order**. Try to guess what these buttons will look like inside the window. Yes, this is what we ex... play with ''width'' and ''height'' for a moment. Look, we've added some arguments to the previous sni
2.4 Shaping the main window and conversing with the user
13 Resultats, Darrera modificació:
although we agree it’s not very elegant. Take a look at the code we've provided in the editor. <cod... ll('wm', 'iconphoto', window._w, PhotoImage(file='logo.png')) window.bind("&lt;Button-1&gt;", lambda e... directly invokes one of the ''tkinter'' internal, low-level mechanisms directly communicating with the... ll('wm', 'iconphoto', window._w, PhotoImage(file='logo.png')) window.bind("<Button-1>;", lambda e: win
1.5 A simple GUI application
12 Resultats, Darrera modificació:
ts** and **conventions**. Our fabulous goal will look like the vision presented below: {{ :info:curso... nstruct a window and launch an event controller – look at the code in the editor to see how to do it. ... = tk.Tk() window.mainloop() </code> Our window looks like this one for now: {{ :info:cursos:pue:pyt... ndow.mainloop() </code> This is what our window looks like now: {{ :info:cursos:pue:python-pcpp1:m3:
1.6 Events and how to handle them
12 Resultats, Darrera modificació:
o string. And this is what the final message box looks like: {{ :info:cursos:pue:python-pcpp1:m3:pas... f click(): tk.messagebox.showinfo("Click!","I love clicks!") window = tk.Tk() label = tk.Label(w... callback. The window along with its message box looks like this: {{ :info:cursos:pue:python-pcpp1:m... nch your callback with; the ''callback'' itself. Looks clear, doesn’t it? Of course, there are two q
1.7 Visiting widgets’ properties
12 Resultats, Darrera modificació:
prop"] = new_val </code> Let’s see it in action. Look at the example we've provided in the editor. <... * a new value to the property. This is what they look like: <code python> old_val = Widget.cget("prop... y of communicating with the widget’s properties. Look at the code in the editor. <code python> impor... el'' widget to demonstrate three different fonts. Look at the code in the editor. <code python> impor
2.5 Working with the Canvas
11 Resultats, Darrera modificació:
need. Let’s start with a simple example. Take a look at the code. <code python> import tkinter as t... 0) button.grid(row=1) window.mainloop() </code> Look at the sample code we've provided in the editor... invocation. Can you predict what the result will look like? {{:info:cursos:pue:python-pcpp1:m3:paste... hon-pcpp1:m3:pasted:20231228-122359.png}} Take a look at the code in the editor. This example’s effec
1.4 Coloring your widgets
7 Resultats, Darrera modificació:
Let's check if tkinter understands **English** – look at the code in the editor, our test is there. ... ts little secret. Can you see? The colors of the lowered (pressed) button are **gray** still. Why? B... ork well and it really does. Let's take a closer look at this. When all the components are set to ze... #0F0F0F0), you will get **254 shades of gray**. Look at the code in the editor. We want to show you
2.2 A small lexicon of widgets - Part 2
5 Resultats, Darrera modificació:
rt** of the window and to treat it as a kind of //local window//. Such a //window works// as a **maste... ou place a widget inside a Frame, you measure its location relative to the Frame’s **upper-left corner... hon-pcpp1:m3:pasted:20231228-111827.png}} Take a look at the example in the editor. <code python> im... and a **title** (also visible). The title may be located at one of 12 possible places on the border l
2.3 A small lexicon of widgets - Part 3
5 Resultats, Darrera modificació:
* a classic menu is actually a **horizontal bar** located at the top of the application window; * th... t we need something quicker and more convenient. Look at the code below. We’ve made two changes – we’... ed cascade requires some steps you already know – look, we’ve engaged the ''for'' loop to simulate the presence of eight recently opened files (lines #28
1.8 Interacting with widget methods
4 Resultats, Darrera modificació:
ple will shed more light on it than telling you a long and winding story. <code python> import tkinte... his gives the application the ability to blink as long as the application is running. Try to change t... hat ''Widget'' is an existing widget, the methods look as follows: <code python> wi.focus_get() wi.foc... was invoked, so you have to choose it carefully. Look at the code we've provided in the editor. This
1.9 Looking at variables
2 Resultats, Darrera modificació:
= 1.9 Looking at variables == Variables To implement some of its functions, Tkinter uses a very specia... iables **cooperate** with their observers. Take a look at it, we've provided it in the editor. <code
2.1 A small lexicon of widgets - Part 1
2 Resultats, Darrera modificació:
ed it many times before. You already know what it looks like and how it works, so we’re going to limit... hon-pcpp1:m3:pasted:20231228-105314.png}} Take a look at the code in the editor pane. The sample we’v