Skip to content

Commit f14836b

Browse files
committed
tkinter messagebox
1 parent 6ec55c7 commit f14836b

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

advanced-oop.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ print(show) # Output: Insurrextion had a turnout of 17000
3333
```
3434
`__doc__` - this attribute contains the docstring of the class or function. It is used to provide documentation for the class or function
3535
```python
36+
"""
37+
Comments can go in here but they will be ignored and they won't be returned by __doc__
38+
"""
3639
def greet(name):
3740
"""Say hello to the given person"""
3841
return f"Hello, {name}!"

coding-conventions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Standards Track PEPs describes a new feature or implementation in Python. They i
102102

103103
### [Sections](https://peps.python.org/pep-0001/#what-belongs-in-a-successful-pep)
104104
#### Abstract
105-
A short summary and description of the technical issue being addressed.
105+
A short (~200 word) summary and description of the technical issue being addressed.
106106
#### Preamble
107107
[RFC 2822](https://datatracker.ietf.org/doc/html/rfc2822.html) headers, including the title, author, metadata and status of the PEP.
108108
#### Open Issues

gui-programming.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ def click_icon(event):
5151

5252
`activebackground` - the background colour of the widget when it is active/under the cursor
5353

54-
- `Entry` - a single-line text input field. It can be used to get user input.
54+
- `Entry` - a single-line text input field. It can be used to get user input.
55+
56+
- `entry.insert()` - used to insert text into the entry field at a specific position or set an initial value
57+
5558
```python
5659
entry.insert(0, "Please enter your name")
5760
entry.insert(5, "*****")
@@ -93,7 +96,7 @@ for item in ["Laudrup", "McCoist", "Albertz", "Ferguson"]:
9396
# insert the item at the END of the listbox
9497
hof_gers.insert(tk.END, item)
9598
```
96-
* `Canvas` - a widget that can be used to draw shapes, images, and text. Tkinter does not support 3D graphics. For complex 3D graphics, libraries such as [PyOpenGL](https://pyopengl.sourceforge.net/) and [Visualisation Toolkit (VTK)](https://pypi.org/project/vtk/) would be more suitable.
99+
* `Canvas` - a widget that can be used to draw shapes, images, and text in a window. Tkinter does not support 3D graphics. For complex 3D graphics, libraries such as [PyOpenGL](https://pyopengl.sourceforge.net/) and [Visualisation Toolkit (VTK)](https://pypi.org/project/vtk/) would be more suitable.
97100

98101
| Widget | Description | Clickable? |
99102
|---------------|----------------------------------------------|----------------------------------|
@@ -139,4 +142,16 @@ def on_button_click(event):
139142

140143
button = tk.Button(root_window, text="Click Me")
141144
button.bind("<Button-1>", on_button_click)
142-
```
145+
```
146+
## messagebox
147+
There are eight types of messageboxes:
148+
1. showinfo
149+
2. showwarning
150+
3. showerror
151+
4. askquestion
152+
5. askokcancel
153+
6. askretrycancel
154+
7. askyesno
155+
8. askyesnocancel
156+
157+
Messages boxes are modal and will return a subset of (True, False, OK, None, Yes, No) based on the user's selection

0 commit comments

Comments
 (0)