Skip to content

Instantly share code, notes, and snippets.

@typemytype
Created May 3, 2014 07:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save typemytype/26470d5d3773920465cb to your computer and use it in GitHub Desktop.
Save typemytype/26470d5d3773920465cb to your computer and use it in GitHub Desktop.
Add buttons to a Space Center
from mojo.UI import CurrentSpaceCenter
from vanilla import *
class AddButtonToSpaceCenter:
def __init__(self):
sp = CurrentSpaceCenter()
l, t, w, h = sp.top.glyphLinePreInput.getPosSize()
sp.top.glyphLinePreInput.setPosSize((l + 50, t, w, h))
l, t, w, h = sp.top.glyphLineInput.getPosSize()
sp.top.glyphLineInput.setPosSize((l + 50, t, w, h))
sp.myButton = Button((10, 10, 40, 22), "OK", callback=self.buttonHitCallback)
def buttonHitCallback(self, sender):
print "Do something"
AddButtonToSpaceCenter()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment