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
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)
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
self.p = Path()
self.stopn = self.startlen * (self.short ** self.maxit)
with ImageContext(self.size, self.size) as cx:
self.p.line_width = 0.9
self.branch(self.startlen, self.size/2, self.size*4/5, 5*pi/4)
def branch(self, len, x, y, t):
if len > self.stopn:
x1, y1 = r(len, len, self.thl+t)
self.branch(len*self.short, x+x1, y+y1, self.thl+t)
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)
if __name__ == '__main__':
s = tree()
#s.thl += 0.25
#for i in range(100):
Thank you very much!
I wasn't checking for a few days, now I have even someone writing code for me, wasn't intended by request - @abcabc thank you very much for your effort, you shouldn't have :)
also a big thank you @mikael! Made things clearer.
I think I get it from here. As I'm already thanking, some heartful of thankyous also to @omz for the great Pythonista app!
I forgot to mention the obvious, is what I normally associate help() with. That is help(class.method).
@omz, I mention this but understand very low on the priority list, but 2 things I think would be nice in the editor.
A toggle switch in the popup sheet of the file class/methods/functions to show hide the prototype. It is nice and clean just to see the method/func name, but sometimes would save time if could see the prototype also.
Not as important. But when a user class selected and your quick help button is selected that you could provide the same information as help() does in the popup.
Again, I understand these are not burning issues. But ultimately anything that can help coding on small screens a bonus.