This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ui, editor | |
''' | |
VERY IMPORTANT | |
For the .pyui file to be loaded as you would expect, in the | |
ui Designer you have to go to the top level (no obejects sekected), | |
you will see a field called 'Custom View Class', you need to enter | |
the key that is used for WrapInstance attr that is passed in the | |
bindings param to ui.load_view. With the example below you would | |
use MyClass. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Pythonista Forum - @Phuket2 | |
''' | |
import ui, editor, bz2, base64 | |
#_pyui_file_name = 'booking.pyui' | |
__pyui_str__ =''' | |
QlpoOTFBWSZTWaO7pcYAGNlf4NVVUGd/9T/n3Y6/79/+IAAAQMAAYAv/A+B25OipHWmzGq | |
VFrRVbpiUohIELwkkp6I0jTxJ6QaABoDR6jeoE00AAABJQTBNNNNRU/UAmAAAAAAAABw0e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ui | |
_colors = ['teal', 'deeppink', 'orange', 'blue', 'red'] | |
class CustomTableViewCell(ui.View): | |
''' | |
some magic from @JonB see... | |
https://forum.omz-software.com/topic/3297/ui-tableviewcell-returning-a-custom-class-instead/4 | |
''' | |
def as_cell(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#turtle.py | |
# Basic Turtle graphics module for Pythonista | |
# | |
# When run as a script, the classic Koch snowflake is drawn as a demo. | |
# The module can also be used interactively or from other scripts: | |
# >>> from turtle import * | |
# >>> right(30) | |
# >>> forward(100) | |
# ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
this is crap. i mashed to files together without editing. | |
but i could be something. i have just been to lazy to bring it | |
together. i use it the wrench menu myself. | |
it acually works for meas a quickie when i am looking for a script. | |
''' | |
import ui, editor, console, editor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ui | |
''' | |
Forum user: @Phuket2 | |
licence: I will pay you to use it, license :) | |
3 controls that just manipulate ui.Button's attrs | |
This is more proof of concept rather than finished code. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Forum @Phuket2 | |
import ui, editor | |
class UIShapeBase(object): | |
def __init__(self, frame, *args, **kwargs): | |
self.frame = ui.Rect(*frame) | |
self.margin = (0, 0) | |
self.origin = (0, 0) | |
self.shape = None | |
self.alpha = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ui | |
import base64, bz2, textwrap | |
import clipboard, editor | |
# wrapper.py, Pythonista Forum @JonB | |
# https://forum.omz-software.com/topic/3176/use-a-pyui-file-in-another-pyui-file | |
# remember to add the the name of the class to the 'Custom View Class' | |
# in the .pyui | |
__the_view = \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ui, io | |
def get_max_fontsize(rect, font_name): | |
r = ui.Rect(*rect) | |
last_w = last_h = 0 | |
for i in range(5, 1000): | |
w, h = ui.measure_string('W', max_width=0, |