def __createLonRow(self, rowx): """Create the for entry of longitude. [ (self has all fonts defined) and (rowx >= 0) -> self := self with .__lonLabel, .__lonGroup, and .__ewMenu added and gridded in row=rowx ] """ #-- 1 -- # [ self.__lonLabel := as invariant ] self.__lonLabel = Label(self, anchor=NW, font=self.__labelFont, fg=LABEL_COLOR, text="Lon:") colx = 0 self.__lonLabel.grid(row=rowx, column=colx, ipadx=2, sticky=W) #-- 2 -- # [ self.__lonGroup := as invariant ] self.__lonGroup = AngleEntry(self) colx = colx + 1 self.__lonGroup.grid(row=rowx, column=colx, sticky=E) #-- 3 -- # [ self.__ewVar := as invariant # self.__ewMenu := as invariant ] self.__ewVar = StringVar() self.__ewMenu = dropdown.DropDown(self, self.__ewVar, E_W_CHOICES) colx = colx + 1 self.__ewMenu.grid(row=rowx, column=colx, sticky=W)
def __createDatumRow(self, rowx): """Create the widgets for setting the map datum code. [ self has all fonts set up -> self := self with .__datumLabel and .__datumMenu gridded and .__datumVar slaved to .__datumMenu ] """ #-- 1 -- # [ self.__datumLabel := as invariant ] self.__datumLabel = Label(self, anchor=E, font=self.__labelFont, fg=LABEL_COLOR, text="Datum:") colx = 0 self.__datumLabel.grid(row=rowx, column=colx, sticky=E) #-- 2 -- # [ self.__datumMenu := as invariant ] self.__datumVar = StringVar() self.__datumMenu = dropdown.DropDown(self, self.__datumVar, DATUM_CHOICES) colx = colx + 1 self.__datumMenu.grid(row=rowx, column=colx, columnspan=2, sticky=W)
def __init__(self, resultobj): self.pop_up = dropdown.DropDown() urwid.connect_signal(self.pop_up, 'close', lambda x, key: self.close_pop_up(key)) urwid.connect_signal(self.pop_up, 'render', lambda x: self._invalidate()) self.editor_status = ('', 0) # (edit_text, edit_pos) # pop_up dimensionging and placement self.pop_up_parameters = { 'left': 0, 'top': 0, 'overlay_height': 0, 'overlay_width': 0 } self.max_overlay_height = 8 self.min_overlay_width = 13 self.overlay_width = 1 self.max_size = None # (maxcol,) -- the size parameter to render() self.resultobj = resultobj self.editors = dict() super(PromptWidgetHandler, self).__init__(self._init_mode(DefaultMode.mode_id)) self.resultobj.set_result(self.original_widget.mode_id, "", 'init')
def screenDisplay(self, player): clock = pg.time.Clock() screen = pg.display.set_mode((960, 950)) sus = suspect_cards.Suspect_cards room = room_cards.Room_cards wea = weapon_cards.Weapon_cards COLOR_INACTIVE = (100, 80, 255) COLOR_ACTIVE = (100, 200, 255) COLOR_LIST_INACTIVE = (255, 100, 100) COLOR_LIST_ACTIVE = (255, 150, 150) COLOR_ACTIVE_CONFIRM = (0, 200, 0) COLOR_INACTIVE_CONFIRM = (100, 80, 255) susRoom = [player.getRoom()] #suspect dropdown menu list1 = dropdown.DropDown( [COLOR_INACTIVE, COLOR_ACTIVE], [COLOR_LIST_INACTIVE, COLOR_LIST_ACTIVE], 650, 100, 200, 50, pg.font.SysFont(None, 30), "Select Suspect", sus.getNames(sus)) # susRoom #this should get the player location and auto select it for the dropdown #weapon dropdown menu list2 = dropdown.DropDown( [COLOR_INACTIVE, COLOR_ACTIVE], [COLOR_LIST_INACTIVE, COLOR_LIST_ACTIVE], 375, 100, 200, 50, pg.font.SysFont(None, 30), "Select Weapon", wea.getNames(wea)) #room dropdown menu list3 = dropdown.DropDown( [COLOR_INACTIVE, COLOR_ACTIVE], [COLOR_LIST_INACTIVE, COLOR_LIST_ACTIVE], 100, 100, 200, 50, pg.font.SysFont(None, 30), "Select Room", room.getNames(room)) #this button is the guess button button1 = button.Button( COLOR_INACTIVE, 405, 600, 150, 50, "Guess") # #this button shows the guessed room card buttonRoom = button.Button( COLOR_INACTIVE, 100, 300, 150, 50, str(self.optionRoom) ) # this button shows the guessed weapon card buttonWea = button.Button( COLOR_INACTIVE, 375, 300, 150, 50, str(self.optionWea) ) # this button shows the guessed suspect card buttonSus = button.Button( COLOR_INACTIVE, 650, 300, 150, 50, str(self.optionSus) ) # this button shows which player needs to choose a card to show buttonPla = button.Button( COLOR_INACTIVE, 400, 200, 200, 50, "Player " + str(self.playerNext) + "Choose a card to display" ) # this button confirms the player has seen the matched guess card run = True while run: background_image = pg.image.load("../Image/clue_back.png") clock.tick(30) pg.display.update() event_list = pg.event.get() screen.blit(background_image, [0, 0]) for event in event_list: if event.type == pg.QUIT: run = False selected_option = list1.update(event_list) if selected_option >= 0: list1.main = list1.options[selected_option] selected_option = list2.update(event_list) if selected_option >= 0: list2.main = list2.options[selected_option] selected_option = list3.update(event_list) if selected_option >= 0: list3.main = list3.options[selected_option] if self.failScreen == True: self.showFail(screen) if self.Senario1 == True: self.showSenario1(screen,event) if self.Senario2 == True: self.showSenario2(screen, event) if self.Senario3 == True: self.showSenario3(screen,event) if self.Senario4 == True: self.showSenario4(screen, event) if self.Senario5 == True: self.showSenario5(screen, event) if self.Senario6 == True: self.showSenario6(screen,event) if self.Senario7 == True: self.showSenario7(screen,event) if self.buttonSeen == True: self.showButtonSeen(screen, event) list1.draw(screen) list2.draw(screen) list3.draw(screen) button1.draw(screen) button1.event(screen, event) if button1.event(screen, event) == True: self.check_for_match( list1, list2, list3, screen) pg.display.flip()