This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import vanilla | |
import merz | |
class Demo: | |
def __init__(self): | |
# setup window | |
self.w = vanilla.Window((400, 400), minSize=(150, 150)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AppKit | |
import webbrowser | |
import urllib | |
import json | |
import os | |
import ssl | |
import vanilla | |
from mojo.extensions import ExtensionBundle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get the current glyph | |
glyph = CurrentGlyph() | |
# get the point pen | |
pointPen = glyph.getPointPen() | |
# loop over all contours | |
# convert the glyph to a list first | |
# so we can remove the contour and alter the glyph | |
for contour in list(glyph): | |
# get all the points | |
points = contour.points |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def lerp(value1, value2, factor): | |
return value1 + (value2 - value1) * factor | |
size(400, 400) | |
R = (sqrt(5) - 1) / 2 | |
def F(x1, y1, r, s, t, n): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x, y = 0, 0 | |
w = h = 200 | |
circles = 3 | |
offset = 20 | |
thickness = 26 | |
color1 = (0, 1, 1) | |
color2 = (1, .5, 0) | |
color3 = (1, 0, 1) | |
color4 = (1, 1, 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import vanilla | |
import AppKit | |
class WindowTabCollector: | |
windowNames = [ | |
"GlyphWindow", | |
"FontWindow", | |
"SpaceCenter", | |
"ScriptingWindow", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from AppKit import * | |
t = """Yeah! A designspace is file that contains the plans for an interpolation system for a typeface. It describes how the source fonts relate and how they should interpolate. It defines the dimensions in which the typeface developes, for instance “weight”, “width”, or other things. A designspace also stores information about the instances, specific locations in the designspace that are interesting and what they need to be called. Designspaces can be used to build variable fonts, but you can also use them to generate fixed UFOs. This text is an introduction to designspace construction. It does not go into detail how to design letterforms for interpolation, or things like family planning. That is for other chapters. To avoid getting tangled in typographic terminology, the dimensions in this text are named after colors.""" | |
synth = NSSpeechSynthesizer.alloc().initWithVoice_("com.apple.speech.synthesis.voice.Whisper") | |
synth.startSpeakingString_(t) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import sqrt | |
class AnimationFrame(object): | |
def __init__(self, index, factor): | |
self._index = index | |
self._factor = factor | |
def index(self): | |
return self._index |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AppKit | |
import vanilla | |
from lib.tools.debugTools import ClassNameIncrementer | |
class SpeechRecognizerDelegate(AppKit.NSObject, metaclass=ClassNameIncrementer): | |
def speechRecognizer_didRecognizeCommand_(self, recognizer, command): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import vanilla | |
def showHide(sender): | |
value = "true" | |
if "Hide" in sender.getNSButton().title(): | |
value = "false" | |
os.system(f"defaults write com.apple.finder CreateDesktop {value} && killall Finder") | |