Navigation

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

    Christine Gertsch

    @Christine

    1
    Reputation
    9
    Posts
    440
    Profile views
    1
    Followers
    0
    Following
    Joined Last Online
    Website christinegertsch.net Location Zürich

    Christine Follow

    Best posts made by Christine

    • How to get values from UI elements?

      Working with the Variable object, how can I get attributes, e.g. rgb color values from the ColorWell?

      What I’d like to do is to pick values for one graphic element with the UI and calculate the colors of other elements depending on that first color.

      Is there a documentation where I can find more information on the Variable object?

      Variable([ dict(name="color", ui="ColorWell")], globals())
      
      fill(color)
      
      rect(0,0,1000,1000)
      print(color) # how to get those values?
      
      
      
      posted in General Discussion
      Christine
      Christine

    Latest posts made by Christine

    • mp4 with transparent background?

      Heyhey,
      I need to export an mp4 file with a transparent background. So far, this is not possible from DrawBot, right?
      cheers, Christine

      posted in Feature Requests
      Christine
      Christine
    • RE: How to get values from UI elements?

      Thanks! I didn’t see that one.

      posted in General Discussion
      Christine
      Christine
    • How to get values from UI elements?

      Working with the Variable object, how can I get attributes, e.g. rgb color values from the ColorWell?

      What I’d like to do is to pick values for one graphic element with the UI and calculate the colors of other elements depending on that first color.

      Is there a documentation where I can find more information on the Variable object?

      Variable([ dict(name="color", ui="ColorWell")], globals())
      
      fill(color)
      
      rect(0,0,1000,1000)
      print(color) # how to get those values?
      
      
      
      posted in General Discussion
      Christine
      Christine
    • Messed-up font metrics in Drawbot

      When I use Bungee Color in Drawbot, vertical metrics are not aligning properly. Horizontal spacing is sometimes also not as it is supposed to be. I don’t see this behaviour in other software (and I haven’t seen this with other fonts …).

      Bildschirmfoto 2022-08-15 um 20.05.04.png

      posted in Bugs
      Christine
      Christine
    • RE: UI with update-Function?

      Many thanks, Frederik! Both thoughts are very useful and exactly what I was looking for.

      Now, I don’t manage to link a callback (CheckBox to use color), which is independent of the update Button with the draw function.

      import vanilla
      import drawBot
      from AppKit import NSColor
      
      
      # create a custom controller calss
      class MyController:
          
          def __init__(self):
              # use vanilla to create a window
              self.w = vanilla.Window((800, 800), minSize=(200, 200))
              # add a text box
              self.w.textSizeText = vanilla.TextBox((10, 10, -10, 22), "Text Size:")
              # add a slider
              self.w.textSize = vanilla.Slider((80, 10, -10, 22), value=20, minValue=8, maxValue=50)
              # add a button and set the hit callback to `drawIt`
              self.w.update = vanilla.Button((150, 40, -150, 22), "Update", callback=self.drawIt)
              
              self.w.colors = vanilla.ColorWell((10, 60, -750, -700),color=NSColor.redColor())
              
              self.w.checkBox = vanilla.CheckBox((60, 80, -10, 20), "use color", callback=self.checkBoxCallback, value=True)
              
              # add a drawBot preview
              self.w.preview = drawBot.ui.drawView.DrawView((0, 120, 0, 0))
              self.w.open() # open the window
              
          def checkBoxCallback(self, sender):
              print("check box checked", sender.get()) 
              if self.w.checkBox():
                  color = self.w.colors()
              else:
                  color = 0
               
          def drawIt(self, sender):
              # the callback when ever the button is hit
              # get the font size from the slider
              fontSize = self.w.textSize.get()
         
              # start a new drawing
              drawBot.newDrawing()
              # add a page
              drawBot.newPage(100, 100)
              # set a font size
              drawBot.fontSize(fontSize)
              # draw some thext
              drawBot.text(f"{fontSize}pt Hello foo bar", (10, 10))
              
              
              fill(color)
              rect(0,50,self.w.textSize.get(), 30)
              
              # get the pdf document
              pdf = drawBot.pdfImage()
              # set the pdf document in the preview
              self.w.preview.setPDFDocument(pdf)
              # clean up
              drawBot.endDrawing() 
      
      # open your controller
      MyController()
      
      posted in General Discussion
      Christine
      Christine
    • UI with update-Function?

      I’m working on a small interface which allows me to generate a composition according to a few parameters. The code takes a while to process, so updating in real-time doesn’t work well.

      Is there a way to add an «update»-Button in order to configure the settings first and then update?
      Or does anyone have another idea? (I hope my explanations are clear…)

      posted in General Discussion
      Christine
      Christine
    • RE: More variable fonts nonsense

      Hoi 🙂
      I’m using OS 10.13.6, Drawbot says ModuleNotFoundError: No module named 'helper_functions'

      ––– ah, sorry, I just saw that there’s an extra file with the helper functions.

      posted in Code snippets
      Christine
      Christine
    • RE: More variable fonts nonsense

      Are you able to run that code in Drawbot? The import from helper_functions doesn’t seem to work (?) @jo

      posted in Code snippets
      Christine
      Christine
    • RE: Tutorial request: how to animate a variable font

      Thanks, well explained!

      I wrote a version using a slider to access the axis, instead of making an animation:

      size(300,150) # canvas
      
      # get minimum and maximum values of the font’s axis
      min_val = listFontVariations('Skia-Regular')['wght']['minValue']
      max_val = listFontVariations('Skia-Regular')['wght']['maxValue']
      print min_val, max_val
      
      Variable([
          # create a variable called 'weight' and the related ui is a Slider.
          dict(name="weight", ui="Slider",
              args=dict(
                      value=1,
                      minValue = min_val, # value from variable font
                      maxValue = max_val)), # value from variable font
          ], globals())
          
      font("Skia-Regular")
      fontSize(60)
      fontVariations(wght= weight)
      
      text("Variable", (20,60))    
      print weight
      
      

      0_1523566630676_d94582bf-a745-41e2-be8b-1da15a9e2134-image.png

      posted in Tutorials
      Christine
      Christine