예제 #1
0
    def update(self):
        self.__update__()
        w = HeaderCustomize(self.titulo)
        w.slider = self.slider
        w._atras = self._atras
        w._screen = self._screen
        self.add(w)
        w = CheckBoxList("Color Scheme")
        _w = CheckBox("Light")
        w.add(_w)
        _w = CheckBox("Negro")
        w.add(_w)
        _w = CheckBox("Custom")
        w.add(_w)
        color = SelectColor()

        self.add(w)

        def mostrar():
            nonlocal color
            color.show()

        def ocultar():
            nonlocal color
            color.hidden()

        _w.activador = mostrar
        _w.desactivador = ocultar
        color.hidden()
        self.add(color)
        self.css({
            "padding-left": "20px",
            "padding-right": "20px"
        }, None, ">div:nth-child(n+2)")
    def update(self):
        self.__update__()
        w = HeaderCustomize(self.titulo)
        w.slider = self.slider
        w._atras = self._atras
        w._screen = self._screen
        self.add(w)
        w = MediaManager("Logo")
        w.btn2 = "Elegir logo"
        w.btn1 = "Eliminar logo"
        w.Media = self.Media
        w.placeholder = "No se a elegido un logo"
        self.add(w)

        w = Input("Titulo del sitio")
        self.add(w)
        w = Input("Descripción corta")
        self.add(w)
        w = CheckBox("Muestra el título y descripción del sitio")
        self.add(w)

        w = MediaManager("Icono del sitio")
        w.descripcion = """
		El icono del sitio lo usa el navegador 
		como icono de la aplicación para tu sitio. 
		Los iconos deben ser cuadrados y al menos de 512 píxeles de ancho y alto.
		"""
        w.placeholder = "No se a elegido un logo"
        w.Media = self.Media
        self.add(w)
        self.css({
            "padding-left": "20px",
            "padding-right": "20px"
        }, None, ">div:nth-child(n+2)")
예제 #3
0
    def __init__(self, screen: pygame.Surface):
        self.screen = screen

        font = pygame.font.SysFont("Calibri", 25)
        self.text_name = font.render("Entrez le nom de la prochaine scène :",
                                     False, (255, 255, 255))
        self.input_name = InputText(140,
                                    345,
                                    1000,
                                    30,
                                    text_color=(255, 255, 255),
                                    background_color=(173, 173, 173, 128),
                                    outline_color=(0, 0, 0),
                                    outline=1,
                                    font_size=25)

        self.text_type = font.render("La scène est un choix :", False,
                                     (255, 255, 255))
        self.check_type = CheckBox(500, 500)
예제 #4
0
	def update(self):
		

		self.format=[self.titulo]
		self.__update__()

		if len(self.value)!=0 and len(self.children)==0:
			if type(self.value)==list:
				for elem in self.value:
					opcion=elem[0]+("<span>"+elem[2]+"</span>" if len(elem)==3 else "")

					w=CheckBox(opcion)
					w.value=elem[1]
					w.update()
					self.content(self).append(w.target)
			elif type(self.value)==dict:
				for elem in self.value:
					w=CheckBox(elem)
					w.value=self.value[elem]
					w.update()
					self.content(self).append(w.target)
예제 #5
0
  def AddItem(self,itemId,Caption,X=-1,Y=-1,W=-1):
    posX = X
    posY = Y
    posW = W

    if posW == -1:
      posW = self.W
    if posX == -1:
      posX = self.X
    if posY == -1:
      posY = self.Y+ len(self.buttons) #self.H

    if len(Caption) > posW-3:
      cutoff = len(Caption) - (posW-3 )
      Caption = Caption[:-cutoff]
    button = CheckBox(self.Parent,str(itemId), \
               posY, \
               posX, Caption, itemId)
    button.ACTIVE = 0
    self.Parent.AddControl(button)
    button.SetMethod("CLICK",self._ToggleItem)
    self.buttons.append(button)
    self.H += 1
예제 #6
0
파일: gridtest.py 프로젝트: lumidify/BobGUI
 button9.grid(row=2, column=2)
 button10.grid(row=3, column=2)
 root.config_row(1, weight=1)
 root.config_row(2, weight=2)
 root.config_row(3, weight=3)
 root.config_column(1, weight=1)
 root.config_column(2, weight=2)
 """
 button = Button(root, text="Hello!", command=sys.exit)
 button.grid(row=0, column=0)
 widget4 = ScrollBar(root, width=200, height=20, scrollarea_size=(9000, 20), axis="horizontal")
 widget4.grid(row=0, column=2, sticky="we")
 widget = RadioButtonGroup()
 widget1 = RadioButton(root, group=widget, selected=True)
 widget2 = RadioButton(root, group=widget)
 widget3 = CheckBox(root)
 widget1.grid(row=1, column=1)
 widget2.grid(row=2, column=1)
 widget3.grid(row=2, column=2)
 root.config_column(2, weight=1)
 fullscreen = False
 last_size = screen_size
 while True:
     for event in pygame.event.get():
         if event.type == QUIT:
             pygame.quit()
             sys.exit()
         elif event.type == VIDEORESIZE:
             screen_size = event.dict["size"]
             screen = pygame.display.set_mode(screen_size, RESIZABLE)
             root.resize(width=screen_size[0], height=screen_size[1])
예제 #7
0
def family_screen():
	continued = False
	check_box_list = []
	check_box_list.append(CheckBox(450, 55))
	check_box_list.append(CheckBox(450, 85))
	check_box_list.append(CheckBox(450, 115))
	money = Global.savings + current_level.gameboard.score - 3
	while not (Global.done or continued):

		for event in pygame.event.get():
			if event.type == pygame.QUIT:
				Global.done = True
			elif event.type == pygame.KEYDOWN and event.key == pygame.K_RETURN:
				continued = True
			elif event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
				for b in check_box_list:
					money = b.click(money)

		screen.fill(BLACK)
		expense_text = expenses_font.render("Manage your expenses using the checkboxes below", 1, WHITE)
		screen.blit(expense_text, (10, 10))
		savings_text = expenses_font.render("Savings {:.3f}".format(Global.savings), 1, WHITE)
		screen.blit(savings_text, (10, 50))
		salary_text = expenses_font.render("Salary {:.3f}".format(current_level.gameboard.score), 1, WHITE)
		screen.blit(salary_text, (10, 80))
		rent_text = expenses_font.render("Rent 3", 1, WHITE)
		screen.blit(rent_text, (10, 110))
		total_text = expenses_font.render("Total {:.3f}".format(money), 1, WHITE)
		screen.blit(total_text, (10, 140))
		food_text = expenses_font.render("Food 2", 1, WHITE)
		screen.blit(food_text, (300, 50))
		heat_text = expenses_font.render("Heat 2", 1, WHITE)
		screen.blit(heat_text, (300, 80))
		medicine_text = expenses_font.render("Medicine 2", 1, WHITE)
		screen.blit(medicine_text, (300, 110))

		for i in range(0, len(Global.family_list)):
			name_text = expenses_font.render(Global.family_list[i].name, 1, WHITE)
			screen.blit(name_text, (10, 300 + i * 30))
			state, state_colour = Global.family_list[i].get_state()
			state_text = expenses_font.render(state, 1, state_colour)
			screen.blit(state_text, (200, 300 + i * 30))
		for b in check_box_list:
			b.draw(screen)
		pygame.display.flip()

	if continued:
		Global.savings = money
		for f in Global.family_list:
			if check_box_list[0].activated:
				f.days_hungry = 0
			else:
				f.go_hungry()
			if check_box_list[0].activated:
				f.days_cold = 0
			else:
				f.go_cold()
			if check_box_list[0].activated:
				f.heal()
			else:
				f.die()
예제 #8
0
 def create(texture, text='', groupName='', **kwargs):
     b = RadioButton(CheckBox.createInternal(texture, text, **kwargs),
                     **kwargs)
     b.groupName = groupName
     return b.component
예제 #9
0
 def __init__(self, component):
     CheckBox.__init__(self, component)
     self.buttonStyle = Button.RADIOBUTTON_STYLE
예제 #10
0
 def __init__(self, component):
     CheckBox.__init__(self, component)
     self.buttonStyle = Button.RADIOBUTTON_STYLE
예제 #11
0
 def create(texture, text = '', groupName = '', **kwargs):
     b = RadioButton(CheckBox.createInternal(texture, text, **kwargs), **kwargs)
     b.groupName = groupName
     return b.component
예제 #12
0
    def addCheckBox(self, tag, iconPath, x, y, checked=False, active=True, visible=True, mask=None):
        newCheckBox = CheckBox(iconPath, x, y, checked, active, visible, mask)
        newCheckBox.updateHover()

        self.checkBoxes[tag] = newCheckBox
예제 #13
0
class NewSceneAsk:
    def __init__(self, screen: pygame.Surface):
        self.screen = screen

        font = pygame.font.SysFont("Calibri", 25)
        self.text_name = font.render("Entrez le nom de la prochaine scène :",
                                     False, (255, 255, 255))
        self.input_name = InputText(140,
                                    345,
                                    1000,
                                    30,
                                    text_color=(255, 255, 255),
                                    background_color=(173, 173, 173, 128),
                                    outline_color=(0, 0, 0),
                                    outline=1,
                                    font_size=25)

        self.text_type = font.render("La scène est un choix :", False,
                                     (255, 255, 255))
        self.check_type = CheckBox(500, 500)

    def render(self):
        self.screen.fill((0, 0, 0))

        self.screen.blit(self.text_name, (140, 200))
        self.screen.blit(self.text_type, (140, 500))

        self.input_name.render(self.screen)
        self.check_type.render(self.screen)

        pygame.display.update()

    def start(self):
        in_menu = True

        self.render()
        while in_menu:
            for event in pygame.event.get():
                if event.type == QUIT:
                    return [
                        'quit',
                    ]

                if event.type == MOUSEBUTTONDOWN:
                    if self.check_type.do_hover(pygame.mouse.get_pos()):
                        self.check_type.click()
                        self.render()

                if event.type == TEXTINPUT:
                    self.input_name.type(event)
                    self.render()

                if event.type == KEYDOWN:
                    if event.key == K_RETURN:
                        return [
                            self.input_name.get_value(),
                            self.check_type.get_value()
                        ]
                    else:
                        self.input_name.special_type(event)
                        self.render()
예제 #14
0
    def update(self):
        self.__update__()
        w = HeaderCustomize(self.titulo)
        w.slider = self.slider
        w._atras = self._atras
        w._screen = self._screen
        self.add(w)
        w = ButtonSettings("Ubicaciones de menús")
        w.slider = self.slider
        w.screen = self.screen
        w._screen = 0
        w._siguiente = 2
        self.add(w)

        self.addSeparador()

        w = ButtonSettings("Menús de enlaces de Redes Sociales")
        w.descripcion = "(Actualmente fijado en: Menú de enlaces de Redes Sociales)"
        w.slider = self.slider
        w.screen = self.screen
        w._screen = 1
        w._siguiente = 2
        self.add(w)
        w = ButtonSettings("Top Menú")
        w.descripcion = "(Actualmente fijado en: Top Menú)"

        w.slider = self.slider
        w.screen = self.screen
        w._screen = 2
        w._siguiente = 2
        self.add(w)
        w = ButtonInput("Añadir al menu")
        self.add(w)
        #
        w = HeaderCustomize("Ubicaciones de menús")
        w.slider = self.slider
        w._atras = 1
        w._screen = 3
        self.descripcion = """
		Tu tema soporta 2 menús. Elige qué menú debería aparecer en cada lugar.

		También puedes poner menús en los widgets con el widget “Menú personalizado”
		"""
        self.screen.appendToTab(0, w)
        w = Select("Top Menu")
        w.opciones = [
            "--Eligir--",
            "Menu de enlaces a redes sociales",
            "Top menu",
        ]
        self.screen.appendToTab(0, w)
        e = EnlaceButton("Editar menu")
        self.screen.appendToTab(0, e)
        w = Select("Top Menu")
        w.opciones = [
            "--Eligir--",
            "Menu de enlaces a redes sociales",
            "Top menu",
        ]
        self.screen.appendToTab(0, w)
        e = EnlaceButton("Editar menu")
        self.screen.appendToTab(0, e)

        self.screen.tabs[0].find(">div:nth-child(n+2)").css({
            "padding-left":
            "20px",
            "padding-right":
            "20px"
        })

        w = HeaderCustomize("Menús de enlaces de Redes Sociales")
        w.slider = self.slider
        w._atras = 1
        w._screen = 3
        self.screen.appendToTab(1, w)

        w = Input()
        w.value = "Menús de enlaces de Redes Sociales"
        self.screen.appendToTab(1, w)
        a = Acordion("")

        t = TabAcordion("Yelp")

        w = Input("URL")
        w.value = "https://www.yelp.com"
        t.add(w)

        w = Input("Etiqueta de navegación")
        w.value = "Yelp"
        t.add(w)

        w = CheckBox("Abrir enlace en una nueva pestaña")
        t.add(w)

        w = Input("Atributos del titulo")
        t.add(w)

        w = Input("Relacion con el enlace (XFN)")
        t.add(w)
        #se debe agregar el widget antes de clonar y despues aplicar un reload si se modifican atributos
        w = Textarea("Descripción")
        w.postdescripcion = "La descripción se mostrará en los menús si el tema actual lo soporta."
        t.add(w)

        w = EnlaceButton("Eliminar")
        t.add(w)
        w.color = "red"
        a.addTab(t)
        t2 = t.clone()

        t2.titulo = "Facebook"

        t2.children[0].value = "https://facebook.com"
        t2.reload()
        a.addTab(t2)

        t3 = t.clone()
        t3.titulo = "Twitter"
        t3.children[0].value = "https://Twitter.com"
        t3.reload()
        a.addTab(t3)
        t4 = t.clone()
        t4.titulo = "Instagram"
        t4.children[0].value = "https://Instagram.com"

        a.addTab(t4)

        t5 = t.clone()
        t5.titulo = "Correo electronico"
        t3.children[0].value = "*****@*****.**"
        a.addTab(t5)

        self.screen.appendToTab(1, a)
        check = CheckBoxList("Mostrar ubicación")
        check.value = [
            ["Top Menu", False, "(Actual: Top Menu)"],
            [
                "Menu de enlaces de Redes Sociales", False,
                "(Actual: Menu de enlaces de Redes Sociales)"
            ],
        ]
        self.screen.appendToTab(1, check)
        check2 = CheckBoxList("Opciones de menú")
        check2.value = [
            [
                "Agregar automaticamente nuevas paginas de nivel superior a este menu",
                False
            ],
        ]
        self.screen.appendToTab(1, check2)
        self.screen.tabs[1].find(">div:nth-child(n+2)").css({
            "padding-left":
            "20px",
            "padding-right":
            "20px"
        })

        w = HeaderCustomize("Top Menú")
        w.slider = self.slider
        w._atras = 1
        w._screen = 3
        self.screen.appendToTab(2, w)
        w = Input()
        w.value = "Top Menu"
        self.screen.appendToTab(2, w)

        a = Acordion()
        t = t.clone()
        t.titulo = "Inicio"
        a.addTab(t)
        t = t.clone()
        t.titulo = "Acerca de"
        t.descripcion = "Pagina"
        a.addTab(t)
        t = t.clone()
        t.titulo = "Blog"
        t.descripcion = "Pagina"
        a.addTab(t)
        t = t.clone()
        t.titulo = "Contacto"
        t.descripcion = "Pagina"
        a.addTab(t)
        self.screen.appendToTab(2, a)

        check = check.clone()
        self.screen.appendToTab(2, check)

        check2 = check2.clone()
        self.screen.appendToTab(2, check2.clone())
        self.css({
            "padding-left": "20px",
            "padding-right": "20px"
        }, None, ">div:nth-child(n+2)")