try looking at Action.call(yourfunction)
Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.

Best posts made by ellie_ff1493
-
RE: Scene: detect when an action has finished processing
-
RE: Interactive test
I tried it with scene
from scene import Scene, Node, LabelNode, run class quiz(Scene): def __init__(self): super().__init__() self.pages = [] def setup(self): self.page_now = -1 self.buttons = Node() self.add_child(self.buttons) temp = LabelNode("start quiz?") temp.position = self.size/2 self.buttons.add_child(temp) def touch_began(self, touch): for i in self.buttons.children: if touch.location in i.bbox: if self.page_now < len(self.pages)-1: self.next_page() print("userer picked:", i.text) else: print("end of quiz") def next_page(self): self.buttons.remove_from_parent() self.page_now += 1 question, values = self.pages[self.page_now] page = Node() num_of_nodes = len(values) + 1 h = self.size.h / num_of_nodes w = self.size.w x = self.size.w * 0.5 but = LabelNode(question, font=('Helvetica', 40)) values.append("") for i in range(len(values)): but.anchor_point = (0.5, 1) but.position = (x, self.size.y - (h*i)) but.y_scale = min(w / but.size.x, h/but.size.y) but.x_scale = min(w / but.size.x, h/but.size.y) page.add_child(but) but = LabelNode(values[i], font=('Helvetica', 40)) self.buttons = page self.add_child(page) def add_page(self, question, values): self.pages.insert(-2, (question, values)) if __name__ == "__main__": app = quiz() app.add_page("do you like this code", ["yes", "no"]) app.add_page("do you understand this code", ["yes", "no", "whats code lol"]) app.add_page("if you add lots of text it gets smallergggggggggggggggggggggggggggggggggggggggg", ["oh ok, cool"]) run(app)
-
RE: Generative Art
I made a tree drawing thing a couple of years when I saw this vid, I recommend checking out some of his other videos, they aren’t in python but it’s some really nice concepts and he explains them in terms that can translate to other languages
from ui import ImageContext, Path, set_color, fill_rect from math import sin, cos, pi from random import random #help(random) def r(x, y, t): # t = t +(random() -0.5)*0.5 return x*cos(t) - y*sin(t), y*sin(t) + x*cos(t) class tree: def __init__(self): self.startlen = 50 self.maxit = 9 self.th = 5*pi/4 self.thl = pi/12 self.thr = -pi/12 self.p = Path() self.short = 0.85 self.size = 1000 def draw(self): self.p = Path() self.stopn = self.startlen * (self.short ** self.maxit) with ImageContext(self.size, self.size) as cx: set_color((255,255,255)) fill_rect(0,0,self.size, self.size) set_color((0,0,0)) self.p.line_width = 0.9 self.p.move_to(self.size/2, self.size) self.branch(self.startlen, self.size/2, self.size*4/5, 5*pi/4) self.p.stroke() cx.get_image().show() def branch(self, len, x, y, t): self.p.line_to(x, y) if len > self.stopn: self.p.move_to(x,y) x1, y1 = r(len, len, self.thl+t) self.branch(len*self.short, x+x1, y+y1, self.thl+t) self.p.move_to(x,y) x1, y1 = r(len, len, self.thr+t) self.branch(len*self.short, x+x1, y+y1, self.thr+t) #self.branch(len*self.short, x+x1, y+y1, self.thr+t) self.p.move_to(x,y) if __name__ == '__main__': s = tree() #s.thl += 0.25 #for i in range(100): s.draw()
-
RE: Button Background Colour
@omzI have a suggestion that in the documentation when something is a subclass it always says so and links to the parent. eg at here
"class ui.Button"
becomes
"class ui.Button (subclass of ui.View)"
I have often forgotten something is a subclass or not known
-
RE: New project: yet another [almost pure Python] image optimizer
cool, maybe make it nonblocking so you can add stuff while it works
-
RE: Pygame vs Scene
pygame offers a bit more functions but most users won't use them 99% of the time and I believe you might be able to do most of them in Pythonista if you dig in the c functions.
pythonista is a higher level library so you can make stuff faster, with fewer bugs, and its easier to learn.
I am currently making the scene module in pygame so scene will hopefully work on pc and ios where pygame won't work on ios.
my mess of code >> pyscene
Latest posts made by ellie_ff1493
-
is the python interpreter written in java?
so i wanted to port the scene modal over to pc (if i am aloud), and i found out that _scene2 is builtin to the interpreter so think i found the interpreter in a file called py3kit? i have no idea whats in it apart from it has parts of _scene2 in but this file starts with "CAFEBABE" and that is the magic number for java class files.
-
RE: Using modules not included in Pythonista
from boto3 import * #or import boto3
-
RE: Discord.py 1.2.2 Bot doesn't respond to commands
Just put a few prints in it
-
RE: Discord.py 1.2.2 Bot doesn't respond to commands
Can you do some basic debugging and find out if the functions get called, so we know if it’s a problem with the return or the message isn’t making it to the function
-
RE: Braille application.
i have seen this pop up lots and it looks quite nice, can i contribute to it?
-
RE: I can‘t write a json file in Pythonista
Works fine for me, where are you running the script, it might not have permission to write there
-
uuid?
is there any unique identifier in pythonista i can use to identify devices? im making a game with lan multiplayer and want the sever to remember the device
-
RE: Possible to run full apps? (Want to run Zim.)
zim made for keyboard and mouse, if you do somehow get it working its not going to work with a screen, look at the scene module