def content(self): # fmt: off yield pyui.VStack(alignment=pyui.Alignment.LEADING)( pyui.HStack()( pyui.Toggle(self.items.all_complete, action=self.items.toggle_all), pyui.TextField(self.new_item, "What needs to be done?", action=self.add), ), pyui.ScrollView()( pyui.List(self.selected, builder=lambda item: ( pyui.HStack()( pyui.Toggle(item.complete, label=item.text, action=(self.items.toggle, item)) .modify(ITEM_COMPLETE if item.complete else ITEM_ACTIVE), pyui.Spacer(), pyui.Button(action=(self.items.delete, item), asset=None)( pyui.Icon("trash-alt") ).font(size=12).padding(0) ) )), ).priority(pyui.Priority.HIGH), pyui.HStack( pyui.Text(self.remaining_text), pyui.Button(action=self.items.clear_complete, asset=None)( pyui.Text("Clear Completed").color(60, 150, 255) ).padding(5).disable(not self.items.any_complete), pyui.Spacer(), # TODO: would be nice to pass SegmentedButton an enum? pyui.SegmentedButton(self.selected_filter)( pyui.Text("All"), pyui.Text("Active"), pyui.Text("Completed"), ), ) ).padding(20)
def content(self): # fmt: off yield pyui.VStack(spacing=0)(pyui.HStack()( pyui.Spacer(), pyui.Text(self.formula.value).font(size=11).color(180, 180, 180).padding( 5, 10, 0, 5), ), pyui.HStack()( pyui.Spacer(), pyui.Text(self.result.value).font(size=42).padding(5), ), pyui.Grid(axis=pyui.Axis.VERTICAL, spacing=2, num=4, cram=True)( CalcButton("C", self.clear, BTN_TOP), CalcButton("(", self.add, BTN_TOP), CalcButton(")", self.add, BTN_TOP), CalcButton("/", self.add, BTN_OPERATOR), CalcButton("7", self.add), CalcButton("8", self.add), CalcButton("9", self.add), CalcButton("*", self.add, BTN_OPERATOR), CalcButton("4", self.add), CalcButton("5", self.add), CalcButton("6", self.add), CalcButton("-", self.add, BTN_OPERATOR), CalcButton("1", self.add), CalcButton("2", self.add), CalcButton("3", self.add), CalcButton("+", self.add, BTN_OPERATOR), CalcButton("(…)", self.group), CalcButton("0", self.add), CalcButton(".", self.add), CalcButton("=", self.compute, BTN_OPERATOR), ))
def content(self): # fmt: off yield pyui.VStack()(pyui.TextField(self.text, placeholder="Some text"), pyui.Picker(selection=self.selected)( pyui.Text("Item One"), pyui.Text("Item Two"), pyui.Text("Item Three"), )).padding(20)
def content(self): # fmt: off yield pyui.VStack()(pyui.HStack()( pyui.Text(self.timestamp.value.strftime("%H:%M:%S.%f")), pyui.Button(action=self.update_timestamp)( pyui.Image("images/python.svg").size(height=14), pyui.Text("Update"), ), ), )
def content(self): # fmt: off yield pyui.VStack()( pyui.Slider(self.current), pyui.ProgressBar(self.current), pyui.Text(self.current.value), ).padding(20)
def content(self): # fmt: off yield pyui.VStack(alignment=pyui.Alignment.LEADING, spacing=5)( pyui.Text(self.lang), pyui.TextField(self.description, "Description for {}".format(self.lang)), )
def content(self): # fmt: off yield pyui.HStack(alignment=pyui.Alignment.LEADING, spacing=20)( pyui.VStack(spacing=10, alignment=pyui.Alignment.LEADING)( pyui.ScrollView()(pyui.List(selection=self.selection)( pyui.Text("First Row"), pyui.ForEach(self.dynamic_items.value, lambda item: (pyui.Text(item), )), ), ).priority(pyui.Priority.HIGH), pyui.HStack()( pyui.Spacer(), pyui.Button("Clear", action=self.clear), pyui.Button("+", action=self.create_row), ), ), pyui.Text("Selected rows: {}".format(self.selection.value)), pyui.Spacer(), )
def content(self): # fmt: off yield pyui.VStack(spacing=0)( SearchView(self.search_text), pyui.ScrollView()(pyui.Grid(size=100, flex=True)(pyui.ForEach( self.filtered_icons(), lambda name: (pyui.Rectangle(pyui.VStack() (pyui.Icon(name, size=32), pyui.Text(name). font(size=11))).background(30, 30, 30). padding(5)))).position(pyui.Position.TOP_LEADING)))
def content(self): # fmt: off yield pyui.ScrollView(axis=self.axis)( pyui.Grid(num=self.num, size=self.size, axis=self.axis, flex=self.flex)(pyui.ForEach( range(self.item_count), lambda num: (pyui.Rectangle() (pyui.Text(num + 1).color(255, 255, 255) ).background(120, 120, 120).radius(5).animate()))))
def content(self): # fmt: off yield pyui.VStack(spacing=10)( pyui.Text("Bar Chart"), pyui.Spacer(), pyui.HStack(alignment=pyui.Alignment.TRAILING)(pyui.ForEach( self.bars.value, lambda height, idx: (pyui.Rectangle() (pyui.Text("{:.0f}%".format(height * 100.0)).color( 230, 230, 230).background(0, 0, 0, 160). padding(3).font(size=11).radius(2)).background( random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)).size(height=height).animate( pyui.spring(), 0.3, delay=0.03 * idx)))).priority( pyui.Priority.HIGH), pyui.HStack()( pyui.Button("Fewer Bars", action=self.fewer_bars), pyui.Button("Randomize", action=self.randomize), pyui.Button("More Bars", action=self.more_bars), ), )
def content(self): # fmt: off yield pyui.VStack(alignment=pyui.Alignment.LEADING)( pyui.Text("Enter some text below:"), pyui.TextField(self.line, placeholder="Single line text"), pyui.TextField(self.lines, placeholder="Two line text input").lines(2), pyui.TextField( self.text, placeholder="All the text").lines(None).priority("high"), pyui.HStack()( pyui.Spacer(), pyui.Button("Submit", asset="button.primary"), ), ).padding(20)
def content(self): # fmt: off fg = pyui.Environment( "text").color if self.language.value else sdl2.SDL_Color( 150, 150, 150) yield pyui.VStack(spacing=20)( pyui.HStack()( pyui.TextField(self.language, "Add a new language"), pyui.Button(action=self.new_language)(pyui.Text( "Add {}".format(self.language.value)).color(fg), ).disable( self.language.value == ""), pyui.Spacer(), ), pyui.ForEach(self.languages.value, lambda lang: (DescriptionView(lang=lang))), )
def content(self): # fmt: off yield pyui.Rectangle()(pyui.Text(self.label)).modify(self.mod)
def content(self): # fmt: off if self.size_or_num.value == 0: size = None num = self.num.value else: size = self.size.value num = None yield pyui.HStack(alignment=pyui.Alignment.LEADING)( pyui.VStack(alignment=pyui.Alignment.LEADING)( pyui.Text("Axis"), pyui.SegmentedButton(self.axis)( pyui.Text(pyui.Axis.HORIZONTAL.name), pyui.Text(pyui.Axis.VERTICAL.name), ), pyui.HStack( pyui.Text("Number of items"), pyui.Spacer(), pyui.Text(self.item_count.value).color( 128, 128, 128).priority("high"), ), pyui.Slider(self.item_count, maximum=200), pyui.Text("Fill rows/columns by"), pyui.SegmentedButton(self.size_or_num)( pyui.Text("Number"), pyui.Text("Size"), ), pyui.HStack( pyui.Text("Items per row/column"), pyui.Spacer(), pyui.Text(self.num.value).color(128, 128, 128).priority("high"), ), pyui.Slider(self.num, minimum=1, maximum=10).disable(self.size_or_num.value == 1), pyui.HStack( pyui.Text("Item size"), pyui.Spacer(), pyui.Text(self.size.value).color(128, 128, 128).priority("high"), ), pyui.Slider(self.size, minimum=50, maximum=200).disable(self.size_or_num.value == 0), pyui.Toggle(self.flex, label="Adjust size to fit").disable( self.size_or_num.value == 0), ).padding(10).size(width=300), ItemGridView( item_count=self.item_count.value, size=size, num=num, axis=self.axis.value, flex=self.flex.value, ), )