TOC A. Message Box B. Favicon C. Spin Box A. Message Box Message box is a pop-up window to give notices to users. There are ...
TOC
A. Message Box
Message box is a pop-up window to give notices to users. There are some notice levels, information, warning, and error.
- Window
Image 1
- Info
Image 2
- Warning
Image 3
- Error
Image 4
- Line 4: imports message box, and names it mBox.
- Line 6: defines a method to pop info message box up.
- Line 7: The first argument is title of the message box. The second argument is the message.
- Line 9: defines a method to pop error message box up.
- Line 20: connects Info menu and popInfoBox method.
- Line 23: connects button and popErrBox method.
- Line 26: shows warning message box, when the window is launched right after.
Message box supports YES and NO two buttons.
- Yes or No pop-up
Image 5
- After choosing yes
Image 6
- Line 5: defines the button action.
- Line 6: The first argument is title of the message box. The second argument is the message. IT returns True or False as what a user choose.
- Line 13: updates the label.
- Line 21: defines the button which will pop message box up.
B. Favicon
Favicon is an icon on the top left corner of the window. Tkinter supports us to change favicon.
-
It has soem problems. This code is not working in my machine. I will figure out what problems are.
-
Line 6: sets favicon of the window. Here, jupyter favicon i used.
C. Spin Box
Spin box is similar to entry, but it has up and down buttons to select.
Image 7
- Line 3: imports Spinbox.
- Line 5: defines a method for spin action.
- Line 6: gets the value from spin box.
- Line 7: inserts the value to scrolledtext.
- Line 12: defines a spin box. Its' values are from 0 to 10.
- Line 13: the values can be set by tuple.
COMMENTS