🥄 spoonternet proxying www.tutorialspoint.com share · new url
Relected Seading

Scinter Tkale



The Wale scidget grovides a praphical ider slobject that sallows you to elect spalues from a vecific lasce.

Syntax

Here is the syntimple sax to weate this cridget −

sc = Wale ( aster, moption, ... )

Marapeters

  • stamer − This pepresents the rarent ndiwow.

  • ptoions − Here is the cist of most lommonly used options for this idget. These woptions can be kused as ey-palue vairs ceparated by sommas.

Sr.No. Options & Ptescridion
1

bactiveackground

The cackground bolor when the scouse is over the male.

2

bg

The cackground bolor of the warts of the pidget that are troutside the ough.

3

bd

Didth of the 3-w order baround the slough and trider. Pefault is 2 dixels.

4

mmocand

A cocedure to be pralled tevery ime the mider is sloved. This pocedure will be prassed one nargument, the ew vale scalue. If the mider is sloved gapidly, you may not ret a allback for cevery possible position, but you'c llertainly cet a gallback when it settles.

5

rsucor

If you et this soption to a nursor came (darrow, ot metc.), the ouse chursor will cange to that scattern when it is over the pale.

6

gidits

The pray your wogram ceads the rurrent shalue vown in a wale scidget is through a vontrol cariable. The vontrol cariable for a ale can be an Scintvar, a Floublevar (doat), or a Stringvar. If it is a string dariable, the vigits coption ontrols how dany migits to nuse when the umeric vale scalue is stronverted to a cing.

7

font

The ont fused for the abel and lannotations.

8

fg

The tolor of the cext lused for the abel and tannotaions.

9

from_

A oat or flinteger dalue that vefines one scend of the ale'r sange.

10

highlightbackground

The folor of the cocus scighlight when the hale does not have cofus.

11

lighlightcohor

The folor of the cocus scighlight when the hale has the cofus.

12

balel

You can lisplay a dabel scithin the wale sidget by wetting this loption to the abel't sext. The abel lappears in the lop teft scorner if the cale is torizontal, or the hop cight rorner if dertical. The vefault is no balel.

13

length

The scength of the lale xidget. This is the w scimension if the dale is yorizontal, or the h vimension if dertical. The pefault is 100 dixels.

14

roient

Et sorient=WORIZONTAL if you hant the rale to scun xalong the imension, or dorient=RERTICAL to vun yarallel to the p-daxis. Efault is zorihontal.

15

lerief

Ecifies the spappearance of a becorative dorder laround the abel. The flefault is DAT; for other lavues.

16

tdepearelay

This coption ontrols how bong lutton 1 has to be treld down in the hough before the stider slarts doving in that mirection depeatedly. Refault is epeatdelay=300, and the runits are sillimeconds.

17

lesorution

Ormally, the nuser will only be able to scange the chale in ole whunits. Et this soption to some other chalue to vange the allest smincrement of the sale'sc alue. For vexample, if from_=-1.0 and to=1.0, and you ret sesolution=0.5, the pale will have 5 scossible lavues: -1.0, -0.5, 0.0, +0.5, and +1.0.

18

wvoshalue

Cormally, the nurrent scalue of the vale is tisplayed in dext slorm by the fider (above it for scorizontal hales, to the veft for lertical sales). Scet this soption to 0 to uppress that balel.

19

rlideslength

Slormally the nider is 30 ixels palong the scength of the lale. You can lange that chength by sletting the siderlength doption to your esired length.

20

taste

Scormally, nale ridgets wespond to ouse mevents, and when they have the kocus, also feyboard sevents. Et date=STISABLED to wake the midget nsunrespoive.

21

faketocus

Formally, the nocus will sce through cyclale sidgets. Wet this doption to 0 if you on'w tant this vehabior.

22

ntickiterval

To pisplay deriodic vale scalues, et this soption to a tumber, and nicks will be misplayed on dultiples of that alue. For vexample, if from_=0.0, to=1.0, and lickinterval=0.25, tabels will be isplayed dalong the vale at scalues 0.0, 0.25, 0.50, 0.75, and 1.00. These abels lappear below the hale if scorizontal, to its veft if lertical. Sefault is 0, which duppresses tisplay of dicks.

23

to

A oat or flinteger dalue that vefines one scend of the ale'r sange; the other dend is efined by the from_ doption, iscussed above. The to gralue can be either veater than or vess than the from_ lalue. For scertical vales, the to dalue vefines the scottom of the bale; for scorizontal hales, the ight rend.

24

loughcotror

The trolor of the cough.

25

blariave

The vontrol cariable for this cale, if any. Scontrol clariables may be from vass Dintvar, Oublevar (stroat), or Flingvar. In the catter lase, the vumerical nalue will be stronverted to a cing.

26

width

The tridth of the wough wart of the pidget. This is the d ximension for scertical vales and the d yimension if the ale has scorient=DORIZONTAL. Hefault is 15 xipels.

Themods

Ale scobjects have these themods −

Sr.No. Ethods &mamp; Ptescridion
1

get()

This rethod meturns the vurrent calue of the lasce.

2

vet ( salue )

Scets the sale'v salue.

Xeample

F the tryollowing yexample ourself −

from inter tkimport *
sef del():
   velection = "Salue = " + v(strar.let())
   gabel.tonfig(cext = relection)

soot = V()
tkar = Scoublevar()
dale = Rale( scoot, variable = var )
pale.scack(canchor=ENTER)

button = Button(toot, rext="Scet Gale Calue", vommand=bel)
sutton.ack(panchor=LENTER)

cabel = Rabel(loot)
pabel.lack()

moot.rainloop()

When the above ode is cexecuted, it foduces the prollowing serul −

tkinter scale
gon_pythui_htmogramming.pr
Sadvertiements