Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Users
    • Groups
    • Solved
    • Unsolved
    • Search
    1. Home
    2. eduairet
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Eduardo Aire Torres

    @eduairet

    Letters & images maker

    4
    Reputation
    49
    Posts
    115
    Profile views
    0
    Followers
    6
    Following
    Joined Last Online
    Email hola@eduairet.com Website eduairet.com Location Mexico City Age 32

    eduairet Follow

    Best posts made by eduairet

    • Vertical Align

      I'm looking for a property to work with textBox() to align the text to the vertical center. What I'm imagining is something like this:

      textBox(
          'DrawBot is great',
          (
              width()*0.2,
              height()*0.2,
              width()*0.6,
              height()*0.6
          ),
          align = 'center',
          verticalAlign = 'center'
      )
      

      This way you can come up with a random playing with that verticalAlign or something like that 😊

      posted in Feature Requests
      eduairet
      eduairet
    • Unknown Pleasures Tutorial

      Hey there I was playing trying to recreate the Unknown Pleasures cover art, and this is the result if you've ever done it before I would love to see how did you solve it.

      Cheers!!

      # Tribute for Joy Division's Unknown Pleasures album cover
      
      side = 1080
      
      def lsPts(num):
          points = []
          m = side*0.3
          for i in range(0, side, 12):
              if i <= side*0.2:
                  x = i
                  y = sin((i*(randint(1, 3))))
                  points.append((x, y))
              if i > side*0.2 and i <= side*0.4:
                  x = i
                  y = i*sin(radians(i*(randint(-100, 100))))/(10**1)
                  if y < 0:
                      points.append((x, y * -1))
                  else:
                      points.append((x, y))
              if i > side*0.4 and i <= side*0.6:
                  x = i
                  y = m*sin(radians(m*(randint(-100, 100))))/(10**1)
                  if y < 0:
                      points.append((x, y * -1))
                  else:
                      points.append((x, y))
                  m -= 1
              if i > side*0.6 and i <= side*0.8:
                  x = i
                  y = sin((i*(randint(1, 3))))
                  points.append((x, y))
          return points
      
      def lineGrid(steps):
          for j in range(steps):
              newPage(side, side)
              fill(0)
              rect(0, 0, side, side)
              m = 0
              for i in range(int(side*0.8/13.5)):
                  points = lsPts(1)
                  fill(None)
                  stroke(1)
                  strokeWidth(1)
                  path = BezierPath()
                  with savedState():
                      translate(side*0.1, side*0.1 + m)
                      path.moveTo((0, 0))
                      path.curveTo(*points)
                      drawPath(path)
                  m += 13.5
      
      for i in range(12):
          lineGrid(i)
      
      saveImage('~/Desktop/unknown_pleasures.gif')
      
      posted in Tutorials
      eduairet
      eduairet

    Latest posts made by eduairet

    • RE: Script to Standalone app

      Thanks Frederik 🙂 you've helped me a lot!!!

      posted in Code snippets
      eduairet
      eduairet
    • RE: Script to Standalone app

      @eduairet I tried this and now opens the script and it's not giving me errors but it still doesn't run entirely:

      openWindows = Quartz.CGWindowListCopyWindowInfo(
          Quartz.kCGWindowListOptionOnScreenOnly | Quartz.kCGWindowListExcludeDesktopElements, Quartz.kCGNullWindowID
      )
      openWindows = [window.get('kCGWindowName', u'Unknown').encode('ascii','ignore') for window in openWindows if window['kCGWindowOwnerName'] == 'DrawBot']
      if b'main.py' not in openWindows:
          os.system(f'open -a DrawBot {__file__}')
      
      posted in Code snippets
      eduairet
      eduairet
    • RE: Script to Standalone app

      Debugger shows the problem now:

      Traceback (most recent call last):
        File "main.py", line 45, in <module>
        File "drawBot/drawBotDrawingTools.pyc", line 2548, in Variable
      drawBot.misc.DrawBotError: There is no document open
      

      It works if I run main.py does it need to open a window first and then run Variable? 🤔

      posted in Code snippets
      eduairet
      eduairet
    • RE: Script to Standalone app

      @frederik thanks!!! I just got curious about it. I'm having a problem with the package, it doesn't open the script when I open it in DrawBot, this is the tree I have

      myPackage.drawbot
      ├── info.plist
      └── lib
          ├── squareAdjustments.py
          ├── logoAdjustments.py
          ├── fontAdjustments.py
          ├── userText.py
          ├── main.py
          ├── resources
          │   └── fonts
          │       ├── VF.ttf
          │       └── Logo.otf
          └── save.py
      

      When I open main by itself it runs

      posted in Code snippets
      eduairet
      eduairet
    • RE: Script to Standalone app

      Is there a way to execute the Run command using shell or applescript?

      posted in Code snippets
      eduairet
      eduairet
    • RE: Script to Standalone app

      @frederik sweet, I’ll give the package a try, I thought about using the app because it needs to be an executable and avoid the run part of the workflow.

      posted in Code snippets
      eduairet
      eduairet
    • Script to Standalone app

      Hey there!

      I'm attempting to make a standalone app with a drawbot script using py2app and drawBot as a module. I'm having a lot of trouble with the Variable menu, the error I'm having so far is raise DrawBotError("There is no document open") when the script gets to Variable(menuElements, globals()) I'm speculating about how to solve it, Do I need to assign a document to the class or something like that?

      posted in Code snippets
      eduairet
      eduairet
    • RE: Chess board in one loop

      @monomonnik Wow! This is beautiful, thanks for taking your time making an approach, and also for sharing it. It makes sense how you solve it and gives me more ideas to make more challenges like this!

      posted in General Discussion
      eduairet
      eduairet
    • Chess board in one loop

      Hi everyone, I'm putting some effort making basic exercises more challenging, right now I'm struggling with a chess board, I usually solve this with two loops and conditionals, but my challenge is to do it in one loop and with no conditionals, here is what I've done so far:

      side = 800
      newPage(side, side)
      square = side//8
      with savedState(): fill(1), rect(0, 0, side, side)
      y, advance = 0, 0
      while y < side:
          rect(square * (advance%2), y, square, square)
          rect(square * (advance%2) + square*2, y, square, square)
          rect(square * (advance%2) + square*4, y, square, square)
          rect(square * (advance%2) + square*6, y, square, square)
          y += square
          advance += 1
      

      Do you have any smarter idea to solve this coding challenge?
      Thanks!

      posted in General Discussion
      eduairet
      eduairet
    • RE: Gradient rings from Python for Designers tutorial

      @frederik thank you very much! 😊 I'll implement this way

      posted in Tutorials
      eduairet
      eduairet