21
loading...
This website collects cookies to deliver better user experience
from tkinter import *
master = Tk()
master.geometry=("300x200")
MB = Menubutton ( master, text="Favorite data analysis" )
MB.menu = Menu ( MB, tearoff = 0 )
MB["menu"] = MB.menu
one = IntVar()
two = IntVar()
MB.menu.add_checkbutton ( label="Classification",
variable=one )
MB.menu.add_checkbutton ( label="Regression",
variable=two )
MB.pack()
mainloop()
MB = Menubutton ( master, text="" )
Create a menubutton with text and the window frame parameters.
MB.menu = Menu ( MB, tearoff = 0 )
MB["menu"] = MB.menu
Create a menu object and configure it with the menubutton.
MB.menu.add_checkbutton ( label="Classification",
Add a button to the menubutton and control it using the
variable=one )Intvar()
classes. This is very similar to how we operated on checkboxes and radiobuttons. In case you have missed it, you can check it out here
Learning Python- Intermediate course: Day 29, Sliders in Tkinter We covered sliders in Tkinter. Slider is a type of widget which lets the user choose variable values in a graphical and interactive manner. We saw how to set various parameters like the interval length, length and orientation of the slider. We saw the getter and setter methods of the widget.
Learning Python- Intermediate course: Day 30, Spinbox and Labelbox- We checked out the spinbox and the labelbox widgets. The spinbox widget is a widget which is used to get input from the user navigated through up and down keys. The listbox is a menu type widget which helps the users select from a list of items. We also saw the various types of parameters of the listbox widget, for example the types of selections and length of the listbox. We saw the getter and setter methods of the widget. The type of selection of the listboxes include BROWSE
SINGLE
MULTIPLE
and EXTENDED
Learning Python- Intermediate course: Day 31, Coordinate positions In this part, we made a sample practice program to calculate the discount prices. In this, we used both the spinbox and the slider widgets. In order to place the widgets around in the desired manner, wee used coordinate placing using the .place()
method. Using this method, we placed the widgets in proper x and y coordinates.