def update_display(self): gabarito = [ 'A', 'C', 'C', 'E', 'C', 'C', 'E', 'C', 'B', 'B', 'C', 'D', 'A', 'A', 'D', 'D', 'A', 'D', 'D', 'B', 'E', 'A', 'B', 'C', 'B', 'B', 'C', 'D', 'E', 'B', 'C', 'B', 'B', 'A', 'B', 'B', 'A', 'A', 'E', 'C' ] porcentagem_certas = str((len(certa) * 100) / len(gabarito)) porcentagem_erradas = str((len(errada) * 100) / len(gabarito)) fundorosa = pygame.image.load('fundorosa.jpg') screen.blit(fundorosa, [0, 0]) titulo = font_title.render("RESULTADOS", True, preto) texto1 = font.render( "A quantidade de respostas certas foi de " + str(porcentagem_certas) + "%", True, preto) texto2 = font.render( "A quantidade de respostas erradas foi de " + str(porcentagem_erradas) + "%", True, preto) title_rect = titulo.get_rect() texto1_rect = texto1.get_rect() texto2_rect = texto2.get_rect() screen.blit(titulo, (screen_width / 2 - (title_rect[2] / 2), 60)) screen.blit(texto1, (screen_width / 2.3 - (title_rect[2] / 2), 160)) screen.blit(texto2, (screen_width / 2.3 - (title_rect[2] / 2), 200)) self.Buttongabarito = Buttons.Button() self.Buttongabarito.create_button(self.screen, (0, 0, 0), 375, 370, 200, 50, 0, " Ver gabarito ", (255, 255, 255)) pygame.display.flip()
def initUi(self): """Ui Setup.""" # List setup # items = self.items # items = [item.strip() for item in items.split(',')] # Buttons configuration width = 150 height = 70 roundness = 20 color = qRgb(154, 179, 174) style = """ QLabel { color: black; font-weight: bold; font-size: 30pt; font-family: Asap; }; """ # Buttons creator layout = QHBoxLayout() for key, value in sorted(self.items.items()): setattr(self, value[0], Buttons.StrokeBtn(width, height, roundness, color, value[0], style, index=value[1], obj=value[2], parent=self)) layout.addWidget(getattr(self, value[0])) self.setLayout(layout)
class Window: root = Tk() size = "1000x1000" lay = 1 screenHeight = root.winfo_screenheight() screenWidth = root.winfo_screenwidth() root.geometry(size) button = Buttons(root) button.creatButtons() buttonList = button.buttonList LM = LayoutManager(root,buttonList) LM.getLay1() #layout_1.placeButton() @classmethod def get_root(cls): return cls.root root.mainloop()
def addLink(self, text, location, key=None): """ Adds a link to the breadcumb that can be clicked to return to a previous location """ key = key or text if self.currentLocation: self.trail.append({'field': self.currentLocation, 'term': key}) spacer = Display.Label('spacer') spacer.addClass("BreadCrumbSpacer") spacer.setText(' >> ') self.addChildElement(spacer) value = self.hiddenData.value() if value: value += '[/]' value += text + '[:]' + location + '[:]' + key self.hiddenData.setValue(value) link = Buttons.Link('breadcrumb') link.addClass("BreadCrumbLink") link.setText(text) link.name = unicode(self.linkCount) link.addJavascriptEvent( 'onclick', "submitLink('" + text + "', '" + location + "', '" + key + "', '" + unicode(self.linkCount) + "');") self.currentLocation = location self.currentText = text self.addChildElement(link) self.currentLink = link self.linkCount += 1 self.links.append(link) return link
def main(self): self.Button1 = Buttons.Button() self.Button2 = Buttons.Button() self.display() while True: self.update_display() for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() elif event.type == MOUSEBUTTONDOWN: if self.Button1.pressed(pygame.mouse.get_pos()): process.SpaceTime() if event.type == MOUSEBUTTONDOWN: if self.Button2.pressed(pygame.mouse.get_pos()): exit(process.SpaceTime) pygame.quit()
def __init__(self, id, name=None, parent=None): Layout.Vertical.__init__(self, id, name, parent) self.addClass("WJumpToLetter") self.style['float'] = "left" self.__letterMap__ = {} self.selectedLetter = self.addChildElement( HiddenInputs.HiddenValue(self.id + "SelectedLetter")) for letter in self.letters: link = self.addChildElement(Buttons.Link()) link.addClass("WLetter") link.setText(letter) self.__letterMap__[letter] = link self.selectedLetter.connect('valueChanged', None, self, "selectLetter") self.connect("beforeToHtml", None, self, "__highlightSelectedLetter__") self.addScript("function letterJumpHover(letterJump){" " var letterJump = JUGetElement(letterJump);" " letterJump.paddingBottom = '4px';" " letterJump.paggingTop = '3px';" "}") self.addScript("function letterJumpLeave(letterJump){" " var letterJump = JUGetElement(letterJump);" " letterJump.paddingBottom = '10px';" " letterJump.paggingTop = '10px';" "}")
def __init__(self): # hardcode for now floors = 5 # event for when the car moves to a different floor # one car for now, more to be added and this will change to a list self.car_1_floor_change = Event() #button descriptors, will be made to make all the elevator panel #buttons in the car. button_descriptor_list = [] for x in range(floors): button_name = "button" + str(x) button_descriptor_list.append( Buttons.ButtonDescriptor(button_name, x)) #make CallPanels for each floor self.call_panels = [] for x in range(floors): call_panel_type = Panels.CallPanelType.ANYMIDDLEFLOOR #get the call panel type right, per the floor if (x == 0): call_panel_type = Panels.CallPanelType.BOTTOMFLOOR elif (x == floors - 1): call_panel_type = Panels.CallPanelType.TOPFLOOR call_panel = Panels.CallPanel(self.car_1_floor_change, x, call_panel_type) call_panel.call += self.elevator_call_received self.call_panels.append(call_panel) #make a new elevator panel, for the car self.elevator_panel = Panels.ElevatorPanel(button_descriptor_list, self.car_1_floor_change) #make the elevator car self.elevator_car = ElevatorCar("Car 1", self.elevator_panel) self.elevator_car.floor_changed += self.car_floor_change
def __init__(self): """ Initialising method for MainApplication class. Sets up user interface and connect buttons to handler functions. """ super(MainApplication, self).__init__() self.ui = Buttons.Ui_Form() self.ui.setupUi(self) self._input = str() self._x = None self._y = None self._op = None self._op_table = {'add': operator.add, 'sub': operator.sub, 'mul': operator.mul, 'div': operator.truediv, 'pow': operator.pow} for num in range(10): getattr(self.ui, f'pushButton_{num}').clicked.connect(partial(self.numeric_pressed, str(num))) for operation in self._op_table.keys(): getattr(self.ui, f'pushButton_{operation}').clicked.connect(partial(self.operation_pressed, operation)) self.ui.pushButton_calc.clicked.connect(self.calculate) self.ui.pushButton_ac.clicked.connect(self.clear_all)
def controlsPage(self): controls = True while controls: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() quit() # fills screen screen.fill(teal) screen.blit( pygame.font.Font(FONTNAME, 50).render(title, -1, black), (153, 17)) textSurface, textRectange = Buttons().text_objects( title, self.bigText) textRectange.center = ((display_width / 2), (display_height / 15)) screen.blit(textSurface, textRectange) screen.blit( pygame.font.Font(FONTNAME, 40).render("Controls Page", -1, white), (232, 71)) screen.blit( pygame.font.Font(FONTNAME, 40).render("Controls Page", -1, red), (230, 70)) self.controlButtons() pygame.display.update() clock.tick(FPS)
def start_menu(): bg_music = 'cautious-path-01.mp3' pygame.mixer.music.load(bg_music) pygame.mixer.music.play(-1) start = Buttons.Button() howto = Buttons.Button() quit = Buttons.Button() [win, win_width, win_height] = window() gameit = True start_game = False instuct = False while gameit: win.fill(0) #Parameters: (surface,color,x,y,length,height,width,text,text_color) start.create_button(win, dark_brown, 0.35 * win_width, 0.35 * win_height, 100, 25, 0, "Start", white) howto.create_button(win, dark_brown, 0.35 * win_width, 0.5 * win_height, 100, 25, 0, "How To Play", white) quit.create_button(win, dark_brown, 0.35 * win_width, 0.65 * win_height, 100, 25, 0, "Quit", white) text = font.render("Snake!!", True, white) win.blit(text, (0.42 * win_width, 0.15 * win_height)) pygame.display.flip() for event in pygame.event.get(): if event.type == pygame.QUIT: gameit = False start_game = False break elif event.type == pygame.MOUSEBUTTONDOWN: if start.pressed(pygame.mouse.get_pos()): gameit = False start_game = True if howto.pressed(pygame.mouse.get_pos()): gameit = False instuct = True if quit.pressed(pygame.mouse.get_pos()): gameit = False start_game = False if start_game and gameit == False: play_game(win, win_width, win_height) elif instuct: instructions(win, win_width, win_height) else: pygame.quit()
def init_board(self): """ Creates the default board and places the cells on it (which are Button objects). A board is a list of lists, where each element of the inner list is a cell button. """ for row in range(self.row): # initialize outer list lst = [] for col in range(self.col): # initialize button. Each button has a row, column, frame, and defined image button = Buttons(row, col, self.frame, self.images) # first row grid button.grid(row=row + 1, column=col) # append inner list of buttons lst.append(button) self.cells.append(button) self.board.append(lst)
def __init__(self, id, name, parent): BaseField.__init__(self, id, name=None, parent=None) self.toggleLayout = self.addChildElement(Layout.Vertical()) self.toggleLayout.style["font-size"] = "75%" self.toggleLayout.addClass("Clickable") self.label.style['display'] = "block" self.label.style['margin-top'] = "5px;" self.up = self.toggleLayout.addChildElement(Buttons.UpButton()) self.up.addClass("hidePrint") self.down = self.toggleLayout.addChildElement(Buttons.DownButton()) self.down.setValue('images/count_down.png') self.down.addClass("hidePrint") self.userInput.setValue(0) self.connect("beforeToHtml", None, self, "__addEvents__") self.connect("beforeToHtml", None, self, "__updateReadOnly__")
def callback_inline(call): global salary_calc if call.message: if call.data == "set1": bot.edit_message_text( chat_id=call.message.chat.id, message_id=call.message.message_id, text="Выберите коэф. расчета ЗП. Описание расчета", reply_markup=Buttons.salary_set('Средняя ЗП: по MAX', 'set2')) salary_calc = 'max' if call.data == "set2": bot.edit_message_text( chat_id=call.message.chat.id, message_id=call.message.message_id, text="Выберите коэф. расчета ЗП. Описание расчета", reply_markup=Buttons.salary_set('Средняя ЗП: по MIN', 'set1')) salary_calc = 'min' print(salary_calc)
def menu(surface): """Оперирует окном главного меню. Примает поверхность вывода. """ finished = False vert_control_tick = 0 demo_fig = [] while not finished: surface.fill(sett.WHITE) printer(surface, 'Тетрис', 50, (340, 330)) play_butt = Buttons.Button() settings_butt = Buttons.Button() stat_butt = Buttons.Button() play_butt.create_button(surface, sett.WHITE, 350, 420, 200, 80, 3, "Играть", sett.BLACK) settings_butt.create_button(surface, sett.WHITE, 350, 520, 200, 80, 3, "Настройки", sett.BLACK) stat_butt.create_button(surface, sett.WHITE, 350, 620, 200, 80, 3, "Статистика", sett.BLACK) vert_control_tick, demo_fig = animation(surface, vert_control_tick, demo_fig) for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() elif event.type == MOUSEBUTTONDOWN: if play_butt.pressed(pygame.mouse.get_pos()): new_game = Game(surface) new_game.driver() elif settings_butt.pressed(pygame.mouse.get_pos()): settings(surface) elif stat_butt.pressed(pygame.mouse.get_pos()): stat(surface) pygame.display.flip()
def query_handler(call): global done, msg done = call.data if call.data == 'btn_1': answer = 'Начнем регистрацию команды с ввода названия. Наберите имя команды и, ' \ 'когда будете уверены, подтвердите нажатием на кнопку' bot.send_message(call.message.chat.id, answer, reply_markup=Buttons.keyboard_step2) elif call.data == 'btn_2': answer = 'Получите помощь :-)' bot.send_message(call.message.chat.id, answer, reply_markup=Buttons.keyboard_step1) elif call.data == 'btn_7': answer = 'Вы зарегестрировали вот эти команды. Выберите одну из команд, чтобы увидеть состав этой команды' Buttons.create_btn_teams(Addition.find_my_teams(call)) bot.send_message(call.message.chat.id, answer, reply_markup=Buttons.keyboard_step7_1) Buttons.keyboard_step7_1 = types.InlineKeyboardMarkup() elif call.data == 'btn_3': Addition.create_team(msg) answer = 'Название команды подтверждено. Приступим к наполнению команды спорстменами. ' \ 'Введите ФИО и дату рождения в формате дд.мм.гггг ' \ 'Дальше подтвердите нажатием на кнопку "Утверждаю спортсмена"' bot.send_message(call.message.chat.id, answer, reply_markup=Buttons.keyboard_step3) elif call.data == 'btn_4': Addition.add_members(msg) answer = 'Что будем делать дальше?' bot.send_message(call.message.chat.id, answer, reply_markup=Buttons.keyboard_step4) elif call.data == 'btn_5': answer = 'Введите ФИО и дату рождения в формате дд.мм.гггг ' \ 'Дальше подтвердите нажатием на кнопку "Утверждаю спортсмена"' bot.send_message(call.message.chat.id, answer, reply_markup=Buttons.keyboard_step3) elif call.data == 'btn_6': Addition.members_team(msg) answer = 'Что дальше?' bot.send_message(call.message.chat.id, answer, reply_markup=Buttons.keyboard_step5) elif call.data.startswith('btn_7_1_'): Addition.members_team(call)
def ipauswahl(): #ip waehlen global UDP_IP screen.fill(SCREEN_COLOR) #hellblau (30,144,255) pygame.display.flip() pygame.display.set_caption("Config") text = Buttons.Button() text.write_text(screen, "IP Adresse waehlen", BLACK, B_LENGTH, B_HEIGHT, 50, 0) ippk = Buttons.Button() ipelse = Buttons.Button() iphotspot = Buttons.Button() ippk.create_button(screen, GREEN, 100, 100, B_LENGTH, B_HEIGHT, "ProjectKitchen", WHITE, 0) #dunkelgruen button, weisse schrift ipelse.create_button(screen, GREEN, 400, 100, B_LENGTH, B_HEIGHT, "ArtLab: 192.168.1.137", WHITE, 0) iphotspot.create_button(screen, GREEN, 200, 300, B_LENGTH, B_HEIGHT, "HotspotIP: 192.168.0.100", WHITE, 0) pygame.display.flip() ip = 0 while ip == 0: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() elif event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE or event.unicode == 'q': print "bye!" pygame.quit() sys.exit() elif event.type == MOUSEBUTTONDOWN: if ippk.pressed(pygame.mouse.get_pos()): UDP_IP = '10.10.10.104' ip = 1 if ipelse.pressed(pygame.mouse.get_pos()): UDP_IP = '192.168.1.137' ip = 1 if iphotspot.pressed(pygame.mouse.get_pos()): UDP_IP = '192.168.0.100' ip = 1 sendtopi("IPcheck")
def __init__(self, W, H): self.W = W self.H = H self.M = None self.Clean = None #(function,param) to call in order to clean the ui self.TxtBox = None self.EmptyBut = Buttons.Button(self, (0, 0), (0, 0)) self.M = matrix(W + 1, H + 1, self.EmptyBut) self.screen = pygame.display.set_mode((W, H)) self.background = pygame.Surface((W, H)) pygame.display.set_caption("Stellaris Space Combat Simulator")
def __init__(self, database, remembral_settings): self.__buttons = Buttons.Buttons() self.__database = database self.__remembral_settings = remembral_settings self.__threads = Threads.Threads(self.__database, self.__buttons) self.__commandStart = CommandStart.CommandStart(self.__database, self.__buttons) self.__buttonPressShow = ButtonPressShow.ButtonPressShow(self.__database, self.__buttons) self.__buttonPressDelete = ButtonPressDelete.ButtonPressDelete(self.__database, self.__threads) self.__buttonPressTransfer = ButtonPressTransfer.ButtonPressTransfer(self.__database, self.__threads, self.__buttons) self.__buttonPressCreate = ButtonPressCreate.ButtonPressCreate(self.__threads, self.__database, self.__buttons, self.__buttonPressTransfer) self.__remembrall = None
def load(self, surface): self._surface = surface self.size = self.width, self.height = self._surface.get_size() self._titleFont = pygame.font.Font(AM.font("EmpireStateDeco.ttf"), 60) self._title = "Ayo Olopon" pygame.display.set_caption("Ayo Olopon") self._gameBg = pygame.image.load(AM.img("game_bg.jpg")).convert() self._startButton = Buttons.Button()
def main(self): self.Button1 = Buttons.Button() self.display() while True: self.update_display() for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() elif event.type == MOUSEBUTTONDOWN: if self.Button1.pressed(pygame.mouse.get_pos()): print "Give me a command!"
def addEverything(self): """Add all Sessions to the layout.""" # Buttons configuration width = 90 height = 90 roundness = 10 color1 = qRgb(101, 60, 240) color2 = qRgb(18, 157, 226) style = """ QLabel { color: black; font-weight: bold; font-size: 25pt; font-family: Asap; }; """ # We loop through all session objects in the self.sessions list and # create some UI buttons for each of them for session in self.sessions: indexN = self.sessions.index(session) # Get the session index sessionN = session.getID() # Get the session ID (Folio) # The button object is created btn = Buttons.SessionBtn(width, height, roundness, color1, color2, sessionN, style, parent=self, obj=self, index=indexN) # the button object is added to the layout self.sessionsLayout.addWidget(session) self.btnLayout.addWidget(btn) # This is the button that creates new sessions. NewSessionBtn = Buttons.NewSessionBtn(width, height, roundness, color1, style, parent=self, obj=self) # The button that creates new sessions is only added when there are # less than 13 sessions on the screen because otherwise they overflow # the screen. if len(self.sessions) < 13: self.btnLayout.addWidget(NewSessionBtn)
def addDigit(calc, calcHistory, digit): global BUTTON_FLAG_1, BUTTON_FLAG_2 if NumericalSystemFunctions.returnNumericalSystemNumber() != 10: if BUTTON_FLAG_1 == False: BUTTON_FLAG_1 = True BUTTON_FLAG_2 = False button = Buttons.makeNumSystemDecButton(calc, 'Dec') button['bg'] = '#04346C' button.grid(row=3, column=2, stick='wens', padx=1, pady=1) return '0' elif NumericalSystemFunctions.returnNumericalSystemNumber() == 10: if BUTTON_FLAG_2 == False: BUTTON_FLAG_2 = True BUTTON_FLAG_1 = False button = Buttons.makeNumSystemDecButton(calc, 'Dec') button['bg'] = '#222222' button.grid(row=3, column=2, stick='wens', padx=1, pady=1) global BLOCK if (BLOCK != True): value = calc.get() # Условие для того, чтобы по-умолчанию в меню ввода появлялся ноль if value[0] == '0' and len(value) == 1: value = value[1:] # Условие для того, чтобы в меню ввода нельзя было поставить несколько нолей перед числом elif len(value) > 1: if value[-2] in '–+÷×' and value[-1] in '0': value = value[:-1] # Условие для того, чтобы выполнялось предварительное вычисление if len(value) > 1: if value[-1] in '–+÷×': addHistory(value, calcHistory) value = '' exit calc['state'] = NORMAL calc.delete(0, END) calc.insert(0, value + digit) calc['state'] = DISABLED
def display(self): self.screen = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT), 0, 32) pygame.display.set_caption('FLIR Lepton') pygame.font.init() self.font = pygame.font.Font('freesansbold.ttf', 16) self.ButtonRainbow = Buttons.Button() self.ButtonIronblack = Buttons.Button() self.ButtonGery = Buttons.Button() self.Exit = Buttons.Button() self.rs = [RadioGroup(), RadioGroup(), RadioGroup()] self.r1 = [None, None, None] self.r2 = [None, None, None] self.r3 = [None, None, None] for i in range(0, 3): self.r1[i] = Radio(self, [440, 21 + 82 * i], '20%', True) self.r2[i] = Radio(self, [440, 41 + 82 * i], '10%', False) self.r3[i] = Radio(self, [440, 61 + 82 * i], '5%', False) self.rs[i].add(self.r1[i]) self.rs[i].add(self.r2[i]) self.rs[i].add(self.r3[i])
def display(self): self.screen = pygame.display.set_mode((950, 620)) pygame.display.set_caption("ENEMStudiesQuiz") fundorosa = pygame.image.load('fundorosa.jpg') screen.blit(fundorosa, [0, 0]) titulo1 = font_title.render("INSTRUÇÕES DO JOGO", True, preto) texto1 = font.render( "- Para jogar, basta clicar no botão correspondente a resposta correta.", True, preto) texto2 = font.render( "- Sua pontuação será exibida no final, portanto não saia do jogo.", True, preto) titulo2 = font_title.render("CRIAÇÃO", True, preto) texto3 = font.render( "- Este jogo foi criado na disciplina de Projeto Integrador, ", True, preto) texto4 = font.render( "por alunas do curso Técnico em Informática integrado ao Ensino Médio", True, preto) texto5 = font.render( "do Instituto Federal Catarinense - Campus Blumenau", True, preto) texto6 = font.render("- Priscila Lemke e Vanessa de Souza", True, preto) title1_rect = titulo1.get_rect() texto1_rect = texto1.get_rect() texto2_rect = texto2.get_rect() title2_rect = titulo2.get_rect() texto3_rect = texto3.get_rect() texto4_rect = texto4.get_rect() texto5_rect = texto5.get_rect() texto6_rect = texto6.get_rect() self.screen.blit( titulo1, [screen_width / 2 - (title1_rect[2] / 2), 40], ) screen.blit(texto1, (screen_width / 2 - (texto1_rect[2] / 2), 120)) screen.blit(texto2, (screen_width / 2 - (texto2_rect[2] / 2), 170)) self.screen.blit( titulo2, [screen_width / 2 - (title2_rect[2] / 2), 210], ) screen.blit(texto3, (screen_width / 2 - (texto3_rect[2] / 2), 300)) screen.blit(texto4, (screen_width / 2 - (texto4_rect[2] / 2), 340)) screen.blit(texto5, (screen_width / 2 - (texto5_rect[2] / 2), 380)) screen.blit(texto6, (screen_width / 2 - (texto6_rect[2] / 2), 420)) self.Buttonmenu = Buttons.Button() #Parâmetros: surface, color, x, y, length, height, width, text, text_color self.Buttonmenu.create_button(self.screen, (249, 125, 95), 375, 500, 200, 50, 0, " Voltar ao Menu ", (0, 0, 0)) pygame.display.flip()
def process_step(message): # if message.text=='🔍Найти вакансию': # msg = bot.reply_to(message, 'Введите запрос для поиска вакансии:') # bot.register_next_step_handler(msg, statistics) # if message.text=='📊 Статистика': # print('статистика') if message.text == '⚙Настройки': msg = bot.reply_to( message, 'Советуем оставить настройки "по-умолчанию, если вы не понимаете, какой параметр они регулируют😊', reply_markup=Buttons.settings()) bot.register_next_step_handler(msg, settings)
def main(self): LogFlag = False self.LogButton = Buttons.Button() self.CloseLogButton = Buttons.Button() self.display() self.screen.fill(LIGHT_BLUE) while True: self.update_display(LogFlag) for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() elif event.type == MOUSEBUTTONDOWN: #If the Log button is pressed, then display the window #Change to be based off of mouse position if self.LogButton.pressed(pygame.mouse.get_pos()): #print "- Displaying Log" #print self.queue.get() LogFlag = True elif self.CloseLogButton.pressed(pygame.mouse.get_pos()): #print "- Closing Log" LogFlag = False
def init(self): pg.display.set_caption("Cube Transform") self.xUpButton = Buttons.Button() self.xDownButton = Buttons.Button() self.yUpButton = Buttons.Button() self.yDownButton = Buttons.Button() self.zUpButton = Buttons.Button() self.zDownButton = Buttons.Button() # create buttons aling_y = self._aling_y self.xDownButton.create_button(screen, (100, 100, 100), self._aling_x, aling_y, self._aling_l, self._aling_h, 0, ">", (255, 255, 255)) self.xUpButton.create_button(screen, (100, 100, 100), self._aling_x + 90, aling_y, self._aling_l, self._aling_h, 0, "<", (255, 255, 255)) aling_y += 50 self.yDownButton.create_button(screen, (100, 100, 100), self._aling_x, aling_y, self._aling_l, self._aling_h, 0, ">", (255, 255, 255)) self.yUpButton.create_button(screen, (100, 100, 100), self._aling_x + 90, aling_y, self._aling_l, self._aling_h, 0, "<", (255, 255, 255)) aling_y += 50 self.zDownButton.create_button(screen, (100, 100, 100), self._aling_x, aling_y, self._aling_l, self._aling_h, 0, ">", (255, 255, 255)) self.zUpButton.create_button(screen, (100, 100, 100), self._aling_x + 90, aling_y, self._aling_l, self._aling_h, 0, "<", (255, 255, 255))
def display_control_buttons_init(self,dim): # Control button config "CHANGE URL/EXIT" #Centered self.offset_width = 10 self.button_w = 150 self.button_h = 25 self.start_x = (self.surface.get_width() / 2) - (self.offset_width/2) - self.button_w - 1 self.start_y = 74 #Custom, not centered # self.start_x = 345 # self.start_y = 70 # self.button_w = 125 # self.button_h = 25 # self.offset_width = 5 self.keyboard_button = Buttons.Button() self.exit_button = Buttons.Button() self.keyboard_button_surface = self.surface.subsurface(self.start_x,self.start_y,self.button_w,self.button_h) self.exit_button_surface = self.surface.subsurface(self.start_x+self.button_w+self.offset_width,self.start_y,self.button_w,self.button_h) background_color = (dim,dim,dim) self.keyboard_button_surface.fill(background_color) self.exit_button_surface.fill(background_color) idle_color = (dim,dim,dim) text_color = (0,0,0) #Parameters: surface, color, x, y, length, height, width, text, text_color self.keyboard_button.create_button(self.keyboard_button_surface,idle_color,0,0,self.button_w,self.button_h,0,"Change URL",text_color,False) self.exit_button.create_button(self.exit_button_surface,idle_color,0,0,self.button_w,self.button_h,0,"Exit",text_color,False) if dim == 0: self.keyboard_button_surface.fill(background_color) self.exit_button_surface.fill(background_color) pygame.display.update()
def loadSinks(self): self.sink_list.add(Info.init()) self.sink_list.add(Buttons.init()) self.sink_list.add(Menus.init()) self.sink_list.add(Images.init()) self.sink_list.add(Layouts.init()) self.sink_list.add(Lists.init()) self.sink_list.add(Popups.init()) self.sink_list.add(Tables.init()) self.sink_list.add(Text.init()) self.sink_list.add(Trees.init()) self.sink_list.add(Frames.init()) self.sink_list.add(Tabs.init())
def loadSinks(self): self.sink_list.addSink(Info.init()) self.sink_list.addSink(Buttons.init()) self.sink_list.addSink(Menus.init()) self.sink_list.addSink(Images.init()) self.sink_list.addSink(Layouts.init()) self.sink_list.addSink(Lists.init()) self.sink_list.addSink(Popups.init()) self.sink_list.addSink(Tables.init()) self.sink_list.addSink(Text.init()) self.sink_list.addSink(Trees.init()) self.sink_list.addSink(Frames.init()) self.sink_list.addSink(Tabs.init())
def create_buttons(screen, background_music, volumeOn): """ Create buttons and add them to a button object array """ buttons.append(Buttons.Button('Undo', (135, 470), [65, 0], screen)) buttons.append(Buttons.Button('Shuffle', (135, 535), [65, 0], screen)) buttons.append(Buttons.Button('Hint', (135, 405), [65, 0], screen)) buttons.append(Buttons.Button('NewGame', (135, 600), [65, 0], screen, buttons[0], buttons[1], buttons[2])) buttons.append(Buttons.Button('Info', (135, 665), [65, 0], screen)) buttons.append(Buttons.Button('MusicOn', (970, 40), [-75, -5], screen, volumeOn, background_music))
def loadSinks(self): #self.sink_list.addSink(DataTree.init()) #self.sink_list.addSink(RecipeSystemIFACE.init()) self.sink_list.addSink(ADViewerIFACE.init()) self.sink_list.addSink(RecipeViewer.init()) self.sink_list.addSink(FITSStoreFACE.init()) self.sink_list.addSink(DisplayIFACE.init()) self.sink_list.addSink(Info.init()) if False: self.sink_list.addSink(Buttons.init()) self.sink_list.addSink(Menus.init()) self.sink_list.addSink(Images.init()) self.sink_list.addSink(Layouts.init()) self.sink_list.addSink(Lists.init()) self.sink_list.addSink(Popups.init()) self.sink_list.addSink(Tables.init()) self.sink_list.addSink(Text.init()) if False: #preserving originaly order self.sink_list.addSink(Frames.init()) self.sink_list.addSink(Tabs.init())