Created
April 20, 2019 16:01
-
-
Save typemytype/b43cec4608c7d5f809c0cbc9f5be9a4c to your computer and use it in GitHub Desktop.
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 vanilla import * | |
| class TestConstraints: | |
| def __init__(self): | |
| self.w = Window((400, 400), "AutoLayout", minSize=(200, 200)) | |
| self.w.info = TextBox("auto", "auto layout:", alignment="right") | |
| self.w.input = EditText("auto") | |
| import random | |
| randomText = random.randint(1, 5) * "." | |
| self.w.info1 = TextBox("auto", "auto part layout%s:" % randomText, alignment="right") | |
| self.w.input1 = EditText("auto") | |
| self.w.t2 = TextBox((10, -30, -10, 22), "Old style vanilla with posSize") | |
| constraints = [ | |
| "V:|-padding-[info(>=controlHeight)]-padding-[info1(>=controlHeight)]-80-|", | |
| "V:|-padding-[input(>=controlHeight)]-padding-[input1(>=controlHeight)]-80-|", | |
| "|-padding-[info(info1)]-padding-[input(>=200)]-padding-|", | |
| "|-padding-[info1(info1)]-padding-[input1(>=200)]-padding-|", | |
| ] | |
| metrics = dict(padding=10, controlHeight=22) | |
| self.w.addLayoutConstraints(constraints, metrics) | |
| self.w.open() | |
| TestConstraints() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment