Scale used to control the size of a circle. : Scale « Tkinker « Python Tutorial






Scale used to control the size of a circle.
from Tkinter import *

class ScaleDemo( Frame ):
   def __init__( self ):
      Frame.__init__( self )
      self.pack( expand = YES, fill = BOTH )
      self.master.title( "Scale Demo" )
      self.master.geometry( "220x270" )

      self.control = Scale( self, from_ = 0, to = 200,orient = HORIZONTAL, command = self.updateCircle )
      self.control.pack( side = BOTTOM, fill = X )
      self.control.set( 10 )

      self.display = Canvas( self, bg = "white" )
      self.display.pack( expand = YES, fill = BOTH )

   def updateCircle( self, scaleValue ):
      end = int( scaleValue ) + 10
      self.display.delete( "circle" )
      self.display.create_oval( 10, 10, end, end,fill = "red", tags = "circle" )

ScaleDemo().mainloop()








18.27.Scale
18.27.1.Scale with variableScale with variable
18.27.2.Get scale value
18.27.3.Label, Button, and Scale DemoLabel, Button, and Scale Demo
18.27.4.Scale used to control the size of a circle.Scale used to control the size of a circle.
18.27.5.Scale WidgetsScale Widgets
18.27.6.Show current value of ScaleShow current value of Scale
18.27.7.Scale properties setting in constructorScale properties setting in constructor