Cerca
Heus ací els resultats de la cerca.
Resultats de text complet:
- 2.3 A small lexicon of widgets - Part 3
- nserting, removing, scrolling, selecting, copying and pasting, etc.. We’ll show you only the basic pos... its entire flexibility when we just want to enter and validate a line of text. Here are some of ''Entr... pue:python-pcpp1:m3:pasted:20231228-112558.png}} And now, some of ''Entry''’s methods: {{:info:cursos:... ts **previous** state (using the last_s variable) and restores the field to this state if its current c
- Python Professional Course Series: GUI Programming
- 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 user. They communicate bidirectio... s clear too – it’s a tool used by the user to command a device and to receive its responses. But what
- 1.6 Events and how to handle them
- = 1.6 Events and how to handle them == Event handling As you already know, events are the fuel which pr... ime to show you some details of the events’ lives and anatomy. We’ll also show you how the events are able to influence a widget’s state, and how you control the event manager’s behavior. Fo... od we’ll use to arrange communication between you and your application. Of course, you can use the reg
- 2.4 Shaping the main window and conversing with the user
- = 2.4 Shaping the main window and conversing with the user The main window is a very specific construct... g **two** masters: **you** (supported by tkinter) and your **operating system**. This means than you ca... ation (''PhotoImage()'' is a part of ''tkinter'', and we’re going to tell you more about it soon) <cod... e python> width x height </code> where ''width'' and ''height'' are decimal numbers specifying both di
- 2.1 A small lexicon of widgets - Part 1
- h to make you familiar with ''tkinter'' standards and habits, and at the same time will encourage you to carry out your own experiments and tests. You already know some of the widgets. In ... l widgets fall into two categories: **clickable** and **non-clickable**. We’ll start with the first. W
- 1.3 Settling widgets in the window's interior
- If you don't want to deploy the widgets manually and worry about possible conflicts and failures, you may entrust the whole problem to ''tkinter''. It'll try to guess your intentions and to **find the best location** for each widget. Un... assumptions may not live up to your expectations, and the final result can be really disappointing. Thi
- 2.5 Working with the Canvas
- e that you can cover with drawings, text, frames, and other widgets. Please treat this story as a basic... more for you – for example, it can scroll itself and react to many events – we hope you’ll explore the... 380) button = tk.Button(window, text="Quit", command=window.destroy) canvas.grid(row=0) button.grid(ro... pecified coordinates (xi,yi), starting at (x0,y0) and ending at (xn,yn) – as you can see, each pair of
- 1.7 Visiting widgets’ properties
- ready know, every widget has a set of properties, and the widget’s user is able to **change** them by modifying the widget’s **appearance** and **behavior**. We’ll show you how to manipulate properties and present a basic set of the most usable widget pro... u have to use one of two possible ways of reading and setting widget properties’ values. The first met
- 1.2 Let TkInter speak!
- bunch of functions, constants, classes, objects, and modules used to build GUI applications. The GUI ... s. We’ll do it step-by-step. Ready The simplest (and at the same time the less controllable) way of im... o access some modules built-in within the package and you will still have to import them separately. As... ute**, **deaf** to the same extent as it is mute, and thus completely indifferent to any input. Don't w
- 1.5 A simple GUI application
- om scratch Now we're going to build a very simple and rather useless GUI application. Does that sound w... ou more accustomed to some ''tkinter'' **habits** and **conventions**. Our fabulous goal will look lik... As everyone knows, Rome wasn't built in a day, and our application isn't an exception. We'll start w... absolutely **obvious** – we'll construct a window and launch an event controller – look at the code in
- 1.8 Interacting with widget methods
- . Now we’re going to show you a few more of them, and we’ll start with two which seem to be very specif... tion** (expressed in milliseconds: 1 s = 1000 ms) and the second **points to an existing function**; su... ill shed more light on it than telling you a long and winding story. <code python> import tkinter as t... he f frame’s background color from white to black and back depending on the state of the ''is_white'' v
- 1.4 Coloring your widgets
- have dedicated properties to handle their colors and we will tell you about them while discussing the ... '' but don't forget that these ways are universal and can be used virtually everywhere. Let's check if... (what is a short form of //“background-color”//) and ''fg'' (//“foreground-color”//). We went along th... just made use of regular English names of colors and packed them inside strings. Does it work? Let's
- 2.2 A small lexicon of widgets - Part 2
- ey’re designed to present **textual** information and don’t have a ''command'' property, although you can use ''bind()'' to simulate similar behavior. The ... k() button = tk.Button(window, text="Go on!", command=plus) button.pack() text = tk.StringVar() label =... k def do_it_again(): text.set(text.get() + "and again...") window = tk.Tk() button = tk.Button(
- 1.9 Looking at variables
- iable of that kind has to be **explicitly created and initialized**. There is another important differ... of what type of value you want to store in them, and don’t change your mind during the variable’s life... variables, you must invoke the proper constructor and save the returned object. Note: the newly create... , you have to invoke its method, named ''set()'', and pass an argument to it. The argument should be of