How do i change the values of a variable in pythonista using a slider
Forum Archive
Sliders in pythonista
@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')
http://khoitsmahq.firstcloudit.com/images%2Fslider%20screenshot.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 screenshots
I 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 ...].
http://khoitsmahq.firstcloudit.com/images%2Fslider%20screenshot.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 screenshots
I 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 ...].
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')
https://docs.python.org/3/library/stdtypes.html#dict.get
Thanks -- done.
@ccc
Just wondering what is the status of Pythonista development ?
I've been around this forum for about 4 years -- I notice the app hasn't been updated since Feb 2020.
I'm guessing there will be no further development.
Thanks,
Karl
https://www.mathpax.com/
https://pyto.app is the best upgrade path that I know of for Pythonista users.
@ccc said
upgrade
That's true for Python's level, available external modules and some functionalities (background, remote notifications, ...) but is far away of what Pythonista provided already some years ago (calendar, contacts, appex mode, ....)
And, of course, app is continuously upgraded.
Here's a screenshot from the App Store:

(I edited this image size and resolution)
I would pay a subscription price to get more frequent updates.
@struct_engineer said
I would pay a subscription price to get more frequent updates.
I agree and you aren't the first person who says that, but unhappily without reaction of @omz, the genius developer of our preferred app
@struct_engineer Ole's Twitter account has been silent for just over a year.
It's a shame Pythonista's falling by the wayside -- it's one of my favourite IDEs on any system for how clean, clear and focused it is.
I'd always hoped he'd follow up by repurposing the UI for website work.
I teach Python and I'd love to recommend Pythonista to my iPad-owning students, but as new Python features slowly work their way into the syllabus, I'm finding it harder to do so...