Package: kivy-garden.radialslider
RadialSliderTheRadialSlideris an angular slider widget, which acts similarly to
the kivy's native linear slider.
The RadialSlider has two components: atrackand athumb. The thumb → ●, can be dragged along the circular path of the track → ◯, with an angle
ranging from 0 to 360 degrees.You can define the position of thethumbvia theangle, thevalue, or thenormalized_value.
Note that these values are also automatically updated as the thumb is dragged.Installpip install kivy_garden.radialsliderImportfrom kivy_garden.radialslider import RadialSliderTips and Considerations:Widget size settingThe Radial Slider will adjust to the smallest size, between height and width.
Setting different sizes for the width and height is not recommended, as although the visible path and thumb will adjust to the smallest size, the widget as a whole will still conform to the size you set.While setting the size incorrectly does not compromise the functionality of the widget itself, you might be overwriting another widget's area resulting in unexpected behavior of the other widget.The example bellow shows the difference between the unespected behavior with wrong fitting and the correct fitting. The red area shows the real widget size.Wrong size definitionWrong size definitionCorrect size definitionsize_hint: (None, None)size: 250, 200❌size_hint: (None, None)size: 200, 250❌size_hint: (None, None)size: 200, 200✔️If you want to set the size based onsize_hint, the proper way would be:For adjust the height to the width:size_hint:(your_size_hint_x, None)height:self.widthOr for adjust the width to the height:size_hint:(None, your_size_hint_y)width:self.heightOr just using thesizeproperty:size_hint:(None, None)size:your_width, your_height# one value must be the same as the other🟡 If the parent of the RadialSlider widget has equal width and height dimensions, eg:size: (200, 200). You can use sizesize_hint_xandsize_hint_yfreely,as long as you set the same value for both, like:size_hint:(0.5, 0.5 ),size_hint:(0.2, 0.2), etc.Example:The RadialSlider widget provides the essential components:Thumb→ ●, andTrack→ ◯.But with a few lines of code, you can change its appearance as you wish. Take a look at the example below, how easy it is.RadialSlider:size_hint:(None,None)size:200,200track_color:"#DEDEDE"# gray tracktrack_thickness:15canvas.before:# white backgroundColor:rgba:rgba("#FFFFFF")Ellipse:size:self.sizepos:self.poscanvas:# blue lineColor:rgba:rgba("#3086BD")Line:width:15circle:self.center_x,self.center_y,self.width/2-15,0,self.anglecap_precision:500Label:pos:self.parent.center_x-self.width/2,self.parent.center_y-self.height/2text:"{}%".format(int(self.parent.value))color:"#808080"font_size:dp(35)APIangleCurrent angle used for the Radial Slider. You can use it for setting
the angle of the thumb in the track in range 0 - 360.angleis defaults to 0.max_valueMaximum value allowed for the Radial Slider.max_valueis defaults to 1.min_valueMinimum value allowed for the Radial Slider.min_valueis defaults to 0.thumb_colorColor of the thumb.thumb_coloris defaults to '#ffffff.'''thumb_diameterDiameter of the thumb.thumb_diameteris defaults to 25.track_colorColor of the track.track_coloris defaults to "#ffffff".track_thicknessThickness of the track.track_thicknessis defaults to 2.'''valueNormalized value inside the range (min_value - max_value). You can use
it for setting the value betwwen the minimum and maximum value.valueis defaults to 0.value_normalizedNormalized value inside the range (min_value - max_value) to 0-1
range. You can also use it for setting the real value without knowing
the minimum and maximum value.value_normalizedis defaults to 0CIEvery push or pull request run theGitHub ActionCI.
It tests the code on various OS and also generates wheels that can be released on PyPI upon a
tag. Docs are also generated and uploaded to the repo as well as artifacts of the CI.ContributingCheck out ourcontribution guideand feel free to improve the RadialSlider flower.🔴 If you have a bug or an idea, create a report to help us improve or suggest an idea for this project by opening an issueLicenseThis software is released under the terms of the MIT License.
Please see theLICENSE.txtfile.