Пример #1
0
 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)))
Пример #2
0
 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()))))
Пример #3
0
 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))),
     )
Пример #4
0
 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(),
     )
Пример #5
0
 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),
         ),
     )