blmacbeth
Sep 19, 2015 - 22:14
(Here)[https://gist.github.com/60bacd65c89e5290f452] is a class I have been working on today, and have wanted for some time. It is a (mostly) complete implementation of the Objective-C UIProgressView class. Let me know what y'all think. I plan on eventually turning the UIImage and UIColor functions into their own modules in Python.
B
EDIT: To fix some weirdness when it comes to setting the progress back to 0.0 make sure you set animated to False.
EDIT 2: I have added these two convenience methods to make things easier when working with progress views.
def add_progress_view_top(to_view, name='progress_view'):
'''Adds a progress bar to top of a view under 'progress_view' '''
# Note: from my tinkering, I have found that the height is 2
progress_view = ProgressView()
progress_view.frame = (0, 0, to_view.width, 2)
progress_view.name = name
to_view.add_subview(progress_view)
def add_progress_view_bottom(to_view, name='progress_view'):
'''Adds a progress bar to the bottom a view under 'progress_view' '''
# Note: from my tinkering, I have found that the height is 2
progress_view = ProgressView()
progress_view.frame = (0, to_view.height-2, to_view.width, 2)
progress_view.name = name
to_view.add_subview(progress_view)