Sliders in pythonista
-
How do i change the values of a variable in pythonista using a slider
-
@Holm little example to change the value of the variable x
import ui x = 0 x_max = 100 def s_action(sender): x = x_max*sender.value sender.name = 'x='+str(int(x)) s = ui.Slider() s.action = s_action s.width = 200 s.name = 'x='+str(int(x)) s.present('sheet')
-
This post is deleted!last edited by struct_engr_
-
http://khoitsmahq.firstcloudit.com/images%2Fslider screenshot.jpeg
https://www.mathpax.com/whats-on-the-pythonista-menu-yep-sliders/
I built an app and am running this app on my iPad.
Credit to:
- [toggle the sliders]
- mikaelho / pythonista – gestures
- [sliders with labels]
- tdamdouni / Pythonista
- Pythonista / slider / SliderWithLabel_danrcook.py
The video shows an app with 8 inputs — 2 integer, 4 float, 2 boolean. Numeric input is tedious — at best; slider input is easier and offers positive feedback. In this app, both approaches are used:
Efficient sliders for user input
Only clear text for user screenshotsI enhanced the slider class to allow min values, floats, rounded floats, booleans. Rounded floats allow only multiples of say 0.5 [0.0, 0.5, 1.0, 1.5 ... ] or of 5 [0, 5, 10, 15 ...].
- [toggle the sliders]
-
Here is the code gist:
khoitsma/augmented_slider.py
https://gist.github.com/khoitsma/3bd07918e41ad6384359432c1c9f199e
-
I’ve completed my new app for iPhone and iPad.
- AISC Bolt Shear Capacity based on AISC 15th Edition
- (American Institute of Steel Construction)
Thanks to all.
-
It would be cool if you could make this a GitHub repo instead of a GitHub gist. That would allow others to suggest improvements in the form or pull requests. For instance:
self.s_type = kwargs['s_type'] if 's_type' in kwargs else 'int' # could be rewritten as self.s_type = kwargs.get('s_type', 'int')
-
Thanks -- done.