Cerca
Heus ací els resultats de la cerca.
Resultats de text complet:
- 2.7 Encapsulation @info:cursos:pue:python-pcpp1:m1
- the behavior of a class representing a water or fuel tank: It would not be wise to pour any amount of... l tank capacity, or request setting the liquid level to a negative value. Python allows you to contro... self.capacity = capacity self.__level = 0 @property def level(self): return self.__level @level.setter def level(
- 2.3 A small lexicon of widgets - Part 3 @info:cursos:pue:python-pcpp1:m3
- 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
- 4.1 Logging in Python @info:cursos:pue:python-pcpp1:m5
- * INFO: 20 * DEBUG: 10 * NOTSET: 0 Each level has a name and a numeric value. You can also define your own level, but those offered by the ''logging'' module are ... gger'' object has methods that set the logging level for you. Take a look at the example in the editor... the logs. The default log format includes the level, the logger name and the message you’ve defined.
- 1.5 A simple GUI application @info:cursos:pue:python-pcpp1:m3
- 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 @info:cursos:pue:python-pcpp1:m3
- 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 Four magic letters: CRUD @info:cursos:pue:python-pcpp1:m4
- t's data in a customer database, etc. At REST level, the creation of new items is implemented by the ... ustomers' records in a database, etc. At REST level, the retrieving of items is implemented by the GE... nt customer’s sales information, etc. At REST level, updating existing data is implemented by the PUT... the blog, purge a picture from the gallery or cancel a customer’s account. At REST level, deleting ex
- 3.1 Advanced techniques of creating and serving exceptions @info:cursos:pue:python-pcpp1:m1
- ): File "exceptions#050.py", line 10, in personnel_check print("\tThe navigator's name is", crew... File "exceptions#050.py", line 19, in personnel_check() File "exceptions#050.py", line 12, in personnel_check raise RocketNotReadyError('Crew is inco... etNotReadyError(Exception): pass def personnel_check(): try: print("\tThe captain's
- 1.7 Visiting widgets’ properties @info:cursos:pue:python-pcpp1:m3
- 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 @info:cursos:pue:python-pcpp1:m3
- '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
- 1.5 What is XML and why do we prefer to use JSON? @info:cursos:pue:python-pcpp1:m4
- <id>1</id> <brand>Ford</brand> <model>Mustang</model> <production_year>1972</production_year> <price currency="USD">35900</pric... </id> <brand>Aston Martin</brand> <model>Rapide</model> <production_year>2010</production_year> <price currency="GBP">32000</price
- 2.4 Shaping the main window and conversing with the user @info:cursos:pue:python-pcpp1:m3
- 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
- 2.8 Composition vs Inheritance - two ways to the same destination @info:cursos:pue:python-pcpp1:m1
- def start(self): print('Starting {}hp diesel engine'.format(self.hp)) my_car = Car(GasEngine... wo different kinds of engine – a gas one or a diesel one. The developer's responsibility is to provide... output> Starting 4hp gas engine Starting 2hp diesel engine </code> To favor composition over inherit... stop()'', ''get_state()''; attribute available: fuel type * vehicle; method available: ''%%__init_
- 1.1 Classes, Instances, Attributes, Methods — introduction @info:cursos:pue:python-pcpp1:m1
- applications because it allows programmers to model entities representing real-life objects. Moreover, OOP allows programmers to model interactions between objects in order to solve re... llows for variables to be used at the instance level or the class level. Those used at the instance level are referred to as **instance variables**, where
- 4.1 Shallow and deep copy operations @info:cursos:pue:python-pcpp1:m1
- Specifically, you'll learn about: * object: label vs. identity vs. value; * the id() function and... inally a variable, which you should treat as a label or name binding, is created, and this label refers to a distinct place in the computer memory. What ... bject 'identity'? Why are the object value and label not enough? The built-in ''id()'' function retur
- 2.1 PEP 20 – The Zen of Python @info:cursos:pue:python-pcpp1:m2
- is a rather subjective experience. But, as Immanuel Kant said, the very **esthetic experience of beau... t normally walk the distance if you wanted to travel from the UK to the USA. Taking a plane would be a... adable. Even though you can actually have any level of nested loops or if statements in Python, **any... kept in mind while creating code. Whenever you feel tempted to give up on readability, the reason be