28.10.2021 Views

Python Tutorial ( PDFDrive )

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Methods

get()

Description

This method returns the current value of the scale.

set ( value )

Example:

Sets the scale's value.

Try the following example yourself:

from Tkinter import *

def sel():

selection = "Value = " + str(var.get())

label.config(text = selection)

root = Tk()

var = DoubleVar()

scale = Scale( root, variable = var )

scale.pack(anchor=CENTER)

button = Button(root, text="Get Scale Value", command=sel)

button.pack(anchor=CENTER)

label = Label(root)

label.pack()

root.mainloop()

When the above code is executed, it produces the following result:

Scrollbar

This widget provides a slide controller that is used to implement vertical scrolled widgets, such as Listbox, Text

and Canvas. Note that you can also create horizontal scrollbars on Entry widgets.

Syntax:

Here is the simple syntax to create this widget:

w = Scrollbar ( master, option, ... )

TUTORIALS POINT

Simply Easy Learning

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!