• 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()
  • Thank you so much, I feel so stupid, but at least I can now get on.

  • 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.

Internal error.

Oops! Looks like something went wrong!