• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python threades.resize_pt函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中threades.resize_pt函数的典型用法代码示例。如果您正苦于以下问题:Python resize_pt函数的具体用法?Python resize_pt怎么用?Python resize_pt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了resize_pt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self):
     
     ''' Constructor
     '''
     global background_image
     self.chatWinFlag = False
     
     #Initialises the chat window
     self.position = threades.resize_pos((15,10))
     self.initial_position = threades.resize_pos((15,10))
     self.final_position = threades.resize_pos((15,750))
     self.update_win_pos=pygame.Rect(threades.resize_pos((150.0,50.0)),threades.resize_pos((900,800)))
     self.imageBox = pygame.image.load(os.path.join('storyboards','storyboard1','images','chat images', 'imageBox.png')).convert_alpha()
     self.chatBox = pygame.image.load(os.path.join('storyboards','storyboard1','images','chat images', 'chatBox.png')).convert_alpha()
     
     #list for storing the images loaded in the chatbox
     self.characterImage={}
     if model.storyboard_file == 'storyboard1/storyboard.pkl':
         self.characterImage['KAMAT']=pygame.image.load(os.path.join('storyboards','storyboard1','images','character images', 'kamat.png')).convert_alpha()
         self.characterImage['SON']=pygame.image.load(os.path.join('storyboards','storyboard1','images','character images', 'son.png')).convert_alpha()          
         self.characterImage['AJMAL']=pygame.image.load(os.path.join('storyboards','storyboard1','images','character images', 'ajmal.png')).convert_alpha()
         self.characterImage['PANCH']=pygame.image.load(os.path.join('storyboards','storyboard1','images','character images', 'panch.png')).convert_alpha()
         self.characterImage['PRIEST']=pygame.image.load(os.path.join('storyboards','storyboard1','images','character images', 'priest.png')).convert_alpha()
         self.characterImage['SUKHDEV']=pygame.image.load(os.path.join('storyboards','storyboard1','images','character images', 'sukhdev.png')).convert_alpha() 
         self.characterImage['FARMER']=pygame.image.load(os.path.join('storyboards','storyboard1','images','character images', 'villager.png')).convert_alpha() 
     else:
         self.characterImage['TONY PERALTA']=pygame.image.load(os.path.join('storyboards','storyboard2','images','character images', 'tony.png')).convert_alpha()
         self.characterImage['STEVENSON GORBACHEV']=pygame.image.load(os.path.join('storyboards','storyboard2','images','character images', 'stevenson.png')).convert_alpha()          
         self.characterImage['GILBERT FERNANDEZ']=pygame.image.load(os.path.join('storyboards','storyboard2','images','character images', 'gilbert.png')).convert_alpha()
         self.characterImage['JOHN TREMBLAY']=pygame.image.load(os.path.join('storyboards','storyboard2','images','character images', 'john.png')).convert_alpha()
         self.characterImage['RAGNAR STEFANSSON']=pygame.image.load(os.path.join('storyboards','storyboard2','images','character images', 'ragnar.png')).convert_alpha()
        
     #  changes made while adding skip buttons etc
     self.size_win =threades.resize_pos((900.0,800.0))
     self.myfont = pygame.font.Font("font.ttf", threades.resize_pt(16))
     self.button_style=gui.defaultButtonStyle.copy()
     self.button_style['font']=self.myfont
     
     #crating label textsurface
     #myfont = pygame.font.Font("font.ttf",10)
     #textColor = (0,0,0)
     #self.label_text='     ENTER : To show whole chat at once              ESC : To skip chat           '
     #self.label_textsurface=gui.renderText(self.label_text,myfont,True,textColor,(700,20),False,True)
     #self.label_tempSurface = pygame.transform.scale(self.chatBox,(800,30))
     
     #creating a label for the chat window
     self.label_text='     ENTER : To show whole chat              ESC : To skip chat           '
     self.myfont2 = pygame.font.Font("font.ttf", threades.resize_pt(20))
     self.labelStyleCopy = gui.defaultLabelStyle.copy()
     self.labelStyleCopy['border-width'] = 1
     self.labelStyleCopy['wordwrap'] = True
     self.labelStyleCopy['autosize'] = False
     self.labelStyleCopy['font'] = self.myfont2
     self.labelStyleCopy['font-color'] = (255,214,150) 
     self.labelStyleCopy['border-color'] = (255,214,150) 
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:55,代码来源:chat.py


示例2: __init__

    def __init__(self):
        ''' Draws the indicator panel on the surface
        '''
        self.update_flag = True
        
        self.name_labels = []
        myfont1 = pygame.font.Font("font.ttf", threades.resize_pt(25))   # For main heading

        myfont2 = pygame.font.Font("font.ttf", threades.resize_pt(20))   # For indicators name
        myfont3 = pygame.font.Font("font.ttf", threades.resize_pt(16))
        # Creating a custom label style
        self.labelstyle1 = gui.defaultLabelStyle.copy()
        self.labelstyle1['border-width'] = 1
        self.labelstyle1['wordwrap'] = True
        self.labelstyle1['autosize'] = False
        self.labelstyle1['font'] = myfont1
        self.labelstyle1['font-color'] = self.font_color
        self.labelstyle1['border-color'] = self.color_grey
        # Drawing main Indicator label
        label = gui.Label(position = threades.resize_pos((900,600)),size = threades.resize_pos((300,45)), parent = threades.desktop, text = "  "+model.text_file.indicators_text[0], style = self.labelstyle1)
        self.name_labels.append(label)
        #print " deawing indicator panel"
        
        # Creating second custom label
        self.labelstyle2 = gui.defaultLabelStyle.copy()
        self.labelstyle2['border-width'] = 0
        self.labelstyle2['wordwrap'] = True
        self.labelstyle2['autosize'] = False
        self.labelstyle2['font'] = myfont2
        self.labelstyle2['font-color'] = self.font_color
        self.labelstyle2['border-color'] = self.color_grey
        
        
        # Drawing all the indicators

        # Creating second custom label
        self.labelstyle3 = gui.defaultLabelStyle.copy()
        self.labelstyle3['border-width'] = 0
        self.labelstyle3['wordwrap'] = False
        self.labelstyle3['autosize'] = True
        self.labelstyle3['font'] = myfont3
        self.labelstyle3['font-color'] = self.font_color
        self.labelstyle3['border-color'] = self.color_grey
        
        # Empty Dictionary for bar
        self.bar_dict = []
        
        name_label_size = threades.resize_pos((300,25))
        self.value_labels = []
        for i in range(5):
            label = gui.Label(position = threades.resize_pos((900,650+50*i)),size = name_label_size, parent = threades.desktop, text = model.text_file.ind_namelist[i], style = self.labelstyle2)
            self.name_labels.append(label)
            self.bar_dict.append(bar((902,677+50*i)))
            label = gui.Label(position = threades.resize_pos((1160,677+50*i)), parent = threades.desktop, text = str(0), style = self.labelstyle3)
            self.value_labels.append(label)
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:55,代码来源:display_panel.py


示例3: graphics

    def graphics(self):
        logo = pygame.image.load(os.path.join("data", "logo.png")).convert()
        self.ff_logo = pygame.transform.scale(logo, threades.resize_pos((1111, 250)))
        threades.screen.fill((0, 0, 0))
        threades.screen.blit(self.ff_logo, threades.resize_pos((40, 50)))

        # Font type
        myfont = pygame.font.Font("font.ttf", threades.resize_pt(17))

        # creating new label showing loading of level
        labelStyleCopy = gui.defaultLabelStyle.copy()
        labelStyleCopy["border-width"] = 1
        labelStyleCopy["wordwrap"] = True
        labelStyleCopy["autosize"] = False
        labelStyleCopy["font"] = myfont
        labelStyleCopy["font-color"] = (0, 200, 0)

        text1 = "Loading...."

        # creating the label
        label = gui.Label(
            position=threades.resize_pos((500, 600)),
            size=threades.resize_pos((250, 50)),
            parent=desktop_level,
            style=labelStyleCopy,
            text=text1,
        )
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:27,代码来源:level_change.py


示例4: graphics

    def graphics(self):
        logo = pygame.image.load(os.path.join('data', 'logo.png')).convert()
        self.ff_logo = pygame.transform.scale(logo,threades.resize_pos((1111,250)))
        threades.screen.fill((0,0,0))
        threades.screen.blit(self.ff_logo,threades.resize_pos((40,50)))

        # Font type
        myfont = pygame.font.Font("font.ttf", threades.resize_pt(17))

        
        #creating new label showing loading of level
        labelStyleCopy = gui.defaultLabelStyle.copy()
        labelStyleCopy['border-width'] = 1
        labelStyleCopy['wordwrap'] = True
        labelStyleCopy['autosize'] = False
        labelStyleCopy['font'] = myfont
        labelStyleCopy['font-color'] = (0,200,0)
        
        if self.level_no==-1:
            text1='Loading New Level...'
        else:
            text1='Loading Level No:'+str(self.level_no)
            
        #creating the label
        label = gui.Label(position = threades.resize_pos((500,600)), size = threades.resize_pos((250,50)), parent = desktop_level,style=labelStyleCopy,text=text1)
        
        #self.run=True
        
        
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:27,代码来源:level_change.py


示例5: tradingWindow

    def tradingWindow(self,handle,buddyName = 'Friend',resource = 'Water', quantity = '0' ,price = '10',trade = 'sell'):
        '''Opens the trading window at the reciever end for trading
        '''        

        #self.font_color = (255,214,150) # Brown
        self.replyhandle = handle
        self.replymessage = ['TradeReply',resource,quantity,price,trade]
        color_blue = (0,0,250)
        myfont = pygame.font.Font("font.ttf", threades.resize_pt(17))
        # Custom Window Style
        win_style = gui.defaultWindowStyle.copy()
        win_style['font'] = myfont
        win_style['bg-color'] = (0,0,0)
        win_style['font-color'] = color_blue
        
        # Calculating position and size of window from the size of the desktop
        position_win =threades.resize_pos((725.0,42.0))
        size_win =threades.resize_pos((470.0,180.0))
    
        # Creating custom label style for the text to be displayed as a message
        labelStyleCopy = gui.defaultLabelStyle.copy()
        labelStyleCopy['wordwrap'] = True
        labelStyleCopy['autosize'] = False
        labelStyleCopy['font'] = myfont
        labelStyleCopy['font-color'] = color_blue
        #labelStyleCopy['font-color'] = font_color
    
        self.win = gui.Window(position = position_win, size = size_win, parent = threades.desktop, text = "Trade " ,style = win_style,shadeable = False, moveable = False)
        # Creating label
        label_text = '\n'+buddyName + ' wants to ' + trade + ' ' + quantity + ' units of '+ resource + '\n at $ '+ price 
        message_label = gui.Label(position = threades.resize_pos((5,5),(470.0,180.0),self.win.size),size = threades.resize_pos((460,120),(470.0,180.0),self.win.size), parent = self.win, text = label_text, style = labelStyleCopy)
        
        # Creating button style
        myfont2 = pygame.font.Font("font.ttf", threades.resize_pt(16))
        button_style = gui.defaultButtonStyle.copy()
        button_style['font'] = myfont2

        self.button_accept = gui.Button(position = threades.resize_pos((100.0,130.0),(470.0,180.0),size_win), size = threades.resize_pos((100.0,40.0),(470.0,180.0),size_win), parent = self.win, text = " Accept ",style = button_style)
        self.button_reject = gui.Button(position = threades.resize_pos((300.0,130.0),(470.0,180.0),size_win), size = threades.resize_pos((100.0,40.0),(470.0,180.0),size_win), parent = self.win, text = " Reject ",style = button_style)
        
        self.button_accept.onClick = self.checkTrade
        self.button_reject.onClick = self.closeWin
        
        sleep(6)
        if self.win:
            self.win.close()
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:46,代码来源:game_sharing.py


示例6: main_menu

    def main_menu(self,pause_flag = True, game_save_flag = False):
        ''' Display the starting menu
        '''
        self.init_game_save_flag = game_save_flag
        self.game_save_flag = False
        logo = pygame.image.load(os.path.join('data', 'logo.png')).convert()
        self.ff_logo = pygame.transform.scale(logo,threades.resize_pos((1111,250)))
        threades.screen.fill((0,0,0))
        threades.screen.blit(self.ff_logo,threades.resize_pos((40,50)))

        # Font type
        myfont = pygame.font.Font("font.ttf", threades.resize_pt(17))

        # Creating new button style
        buttonsurf = pygame.image.load(os.path.join('art','button_green.png')).convert_alpha()
        buttonsurf = pygame.transform.scale(buttonsurf, (36, threades.resize_pt_y(40)))
        self.button_style = gui.createButtonStyle(myfont,(0,0,0), buttonsurf,4,1,4,4,1,4,4,1,4,4,1,4)
        

        self.pause_flag = pause_flag
        #Starting new game button
        if self.pause_flag:
            self.start_button1 = gui.Button(position = threades.resize_pos((475,500)), size = threades.resize_pos((250,50)), parent = desktop2, text = "Start New Game1",style = self.button_style)
            self.start_button1.onClick = self.startup_text
 
            self.start_button2 = gui.Button(position = threades.resize_pos((475,850)), size = threades.resize_pos((250,50)), parent = desktop2, text = "Start new Game2",style = self.button_style)
            self.start_button2.onClick = self.startup_text
            
            #Resume saved level button if a game is saved
            if self.init_game_save_flag == True:
                self.resume_saved_level_button = gui.Button(position = threades.resize_pos((475,430)),size = threades.resize_pos((250,50)), parent = desktop2, text = "Resume Saved Game",style =self.button_style)
                self.resume_saved_level_button.onClick = self.resume_saved_level

            
        else:
            self.resume_button = gui.Button(position = threades.resize_pos((475,500)), size = threades.resize_pos((250,50)), parent = desktop2, text = "Resume Game",style = self.button_style)
            self.resume_button.onClick = self.resume
            
            #Save Game Button
            if proceduralFlow.storyboard_level != 1:
                self.save_button = gui.Button(position = threades.resize_pos((475,430)), size = threades.resize_pos((250,50)), parent = desktop2, text = "Save Current Level",style = self.button_style)
                self.save_button.onClick = self.save_current_level

        
        self.controls_button = gui.Button(position = threades.resize_pos((475,640)), size = threades.resize_pos((250,50)), parent = desktop2, text = "Controls",style = self.button_style)
        self.exit_button = gui.Button(position = threades.resize_pos((475,710)), size = threades.resize_pos((250,50)), parent = desktop2, text = "Exit",style = self.button_style)
        self.instructions_button = gui.Button(position = threades.resize_pos((475,570)), size = threades.resize_pos((250,50)), parent = desktop2, text = "Guide",style = self.button_style)
        self.about_us_button = gui.Button(position = threades.resize_pos((1000,20)), size = threades.resize_pos((150,40)), parent = desktop2, text = "About Us",style = self.button_style)
        
                                      

        self.controls_button.onClick = self.controls
        self.exit_button.onClick = safe_exit
        
        self.instructions_button.onClick = self.instructionsWindow
        self.about_us_button.onClick = self.aboutUsWindow

        self.run = True
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:58,代码来源:Foodforce2.py


示例7: main_menu

    def main_menu(self,pause_flag = True, game_save_flag = False):
        self.init_game_save_flag = game_save_flag
        self.game_save_flag = False
        if threades.game_save_flag:
            self.init_game_save_flag = True
        logo = pygame.image.load(os.path.join('data', 'logo.png')).convert()
        self.ff_logo = pygame.transform.scale(logo,threades.resize_pos((1128,171)))
        threades.screen.fill((0,0,0))
        threades.screen.blit(self.ff_logo,threades.resize_pos((40,90)))

        # Font type
        myfont = pygame.font.Font("font.ttf", threades.resize_pt(17))

        # Creating new button style
        buttonsurf = pygame.image.load(os.path.join('art','button_green.png')).convert_alpha()
        buttonsurf = pygame.transform.scale(buttonsurf, (36, threades.resize_pt_y(40)))
        self.button_style = gui.createButtonStyle(myfont,(0,0,0), buttonsurf,4,1,4,4,1,4,4,1,4,4,1,4)
        self.pause_flag = pause_flag
        if self.pause_flag:
            self.start_button = gui.Button(position = threades.resize_pos((475,500)), size = threades.resize_pos((250,50)), parent = desktop2, text = model.text_file.start_new_game[0],style = self.button_style) 
            self.start_button.onClick = self.select_save_or_new_game
            #Resume saved level button if a game is saved
            if self.init_game_save_flag == True:
                self.resume_saved_level_button = gui.Button(position = threades.resize_pos((475,430)),size = threades.resize_pos((250,50)), parent = desktop2, text = model.text_file.resume_saved_game[0],style =self.button_style)
                self.resume_saved_level_button.onClick = self.select_save_or_new_game

            
        else:
            self.resume_button = gui.Button(position = threades.resize_pos((475,430)), size = threades.resize_pos((250,50)), parent = desktop2, text = model.text_file.resume_game[0],style = self.button_style)
            self.resume_button.onClick = self.resume
            
            self.start_game_again_button = gui.Button(position = threades.resize_pos((475,500)), size = threades.resize_pos((250,50)), parent = desktop2, text = model.text_file.start_game_again[0],style = self.button_style) 
	    self.start_game_again_button.onClick = self.storyboardWindow
            
            #Save Game Button
            if proceduralFlow.storyboard_level != 1:
                self.save_button = gui.Button(position = threades.resize_pos((475,360)), size = threades.resize_pos((250,50)), parent = desktop2, text = model.text_file.save_current_level[0],style = self.button_style)
                self.save_button.onClick = self.save_current_level
            



        self.controls_button = gui.Button(position = threades.resize_pos((475,640)), size = threades.resize_pos((250,50)), parent = desktop2, text = model.text_file.control_button_text[0],style = self.button_style)
        self.exit_button = gui.Button(position = threades.resize_pos((475,710)), size = threades.resize_pos((250,50)), parent = desktop2, text = model.text_file.exit_button_text[0],style = self.button_style)
        self.instructions_button = gui.Button(position = threades.resize_pos((475,570)), size = threades.resize_pos((250,50)), parent = desktop2, text = model.text_file.instructions_window_text[0],style = self.button_style)
        self.about_us_button = gui.Button(position = threades.resize_pos((1000,20)), size = threades.resize_pos((150,40)), parent = desktop2, text = model.text_file.about_button_text[0],style = self.button_style)
        
                                      
        self.controls_button.onClick = self.controls
        self.exit_button.onClick = safe_exit
        
        self.instructions_button.onClick = self.instructionsWindow
        self.about_us_button.onClick = self.aboutUsWindow

        self.run = True
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:55,代码来源:Foodforce2.py


示例8: __init__

 def __init__(self):
     
     ''' Constructor
     '''
     global background_image
     self.chatWinFlag = False
     self.position = threades.resize_pos((15,10))
     self.initial_position = threades.resize_pos((15,10))
     self.final_position = threades.resize_pos((15,750))
     self.update_win_pos=pygame.Rect(threades.resize_pos((150.0,50.0)),threades.resize_pos((900,800)))
     self.imageBox = pygame.image.load(os.path.join('art', 'imageBox.png')).convert_alpha()
     self.chatBox = pygame.image.load(os.path.join('art', 'chatBox.png')).convert_alpha()
     self.characterImage={}
     self.characterImage['KAMAT']=pygame.image.load(os.path.join('art', 'kamat.png')).convert_alpha()
     self.characterImage['SON']=pygame.image.load(os.path.join('art', 'son.png')).convert_alpha()
     self.characterImage['AJMAL']=pygame.image.load(os.path.join('art', 'ajmal.png')).convert_alpha()
     self.characterImage['SUKHDEV']=pygame.image.load(os.path.join('art', 'sukhdev.png')).convert_alpha() 
     self.characterImage['FARMER']=pygame.image.load(os.path.join('art', 'villager.png')).convert_alpha() 
     #  changes made while adding skip buttons etc
     self.size_win =threades.resize_pos((900.0,800.0))
     self.myfont = pygame.font.Font("font.ttf", threades.resize_pt(16))
     self.button_style=gui.defaultButtonStyle.copy()
     self.button_style['font']=self.myfont
     
     #crating label textsurface
     #myfont = pygame.font.Font("font.ttf",10)
     #textColor = (0,0,0)
     #self.label_text='     ENTER : To show whole chat at once              ESC : To skip chat           '
     #self.label_textsurface=gui.renderText(self.label_text,myfont,True,textColor,(700,20),False,True)
     #self.label_tempSurface = pygame.transform.scale(self.chatBox,(800,30))
     
     self.label_text='     ENTER : To show whole chat              ESC : To skip chat           '
     self.myfont2 = pygame.font.Font("font.ttf", threades.resize_pt(20))
     self.labelStyleCopy = gui.defaultLabelStyle.copy()
     self.labelStyleCopy['border-width'] = 1
     self.labelStyleCopy['wordwrap'] = True
     self.labelStyleCopy['autosize'] = False
     self.labelStyleCopy['font'] = self.myfont2
     self.labelStyleCopy['font-color'] = (255,214,150) 
     self.labelStyleCopy['border-color'] = (255,214,150) 
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:40,代码来源:chat.py


示例9: message_window

def message_window():
    ''' Thread to display the messages'''

    font_color = (255,214,150)
    myfont = pygame.font.Font("font.ttf", threades.resize_pt(17))
    # Custom gui.Window Style
    win_style = gui.defaultWindowStyle.copy()
    win_style['font'] = myfont
    win_style['bg-color'] = (0,0,0)
    
    # Calculating position and size of window from the size of the threades.desktop
    position_win =threades.resize_pos((745.0,42.0))
    size_win =threades.resize_pos((450.0,150.0))

    # Creating custom label style for the text to be displayed as a threades.message
    labelStyleCopy = gui.defaultLabelStyle.copy()
    labelStyleCopy['wordwrap'] = True
    labelStyleCopy['autosize'] = False
    labelStyleCopy['font'] = myfont
    #labelStyleCopy['font-color'] = font_color

    while True:
        (text,color) = threades.message.pop_message()
        if text:

            # Creating window
            win_style['font-color'] = color
            labelStyleCopy['font-color'] = color

            win = gui.Window(position = position_win, size = size_win, parent = threades.desktop, text = "Message " ,style = win_style ,closeable = False ,shadeable = False,moveable = False)
            pygame.draw.rect(win.surf,color,threades.resize_rect((3,3,444,144)),1)            
            #win.surf.set_alpha(160)
            # Creating label
            message_label = gui.Label(position = threades.resize_pos((5,50),(450.0,150.0),win.size),size = threades.resize_pos((440,140),(450.0,150.0),win.size), parent = win, text = text, style = labelStyleCopy)
            sleep(6)
            win.close()

        if threades.GAME_EXIT_FLAG:
            return
        sleep(1)
        if threades.GAME_EXIT_FLAG:
            return
        sleep(1)
        if threades.GAME_EXIT_FLAG:
            return
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:45,代码来源:Foodforce2.py


示例10: main_menu

    def main_menu(self,pause_flag = True):
        ''' Display the starting menu
        '''

        logo = pygame.image.load(os.path.join('data', 'logo.png')).convert()
        self.ff_logo = pygame.transform.scale(logo,threades.resize_pos((1111,250)))
        threades.screen.fill((0,0,0))
        threades.screen.blit(self.ff_logo,threades.resize_pos((40,50)))

        # Font type
        myfont = pygame.font.Font("font.ttf", threades.resize_pt(17))

        # Creating new button style
        buttonsurf = pygame.image.load(os.path.join('art','button_green.png')).convert_alpha()
        self.button_style = gui.createButtonStyle(myfont,(0,0,0), buttonsurf,4,1,4,4,1,4,4,1,4,4,1,4)

        self.pause_flag = pause_flag
        if self.pause_flag:
            self.start_button = gui.Button(position = threades.resize_pos((500,500)), size = threades.resize_pos((200,30)), parent = desktop2, text = "Start New Game",style = self.button_style)
            self.start_button.onClick = self.startup_text
        else:
            self.resume_button = gui.Button(position = threades.resize_pos((500,500)), size = threades.resize_pos((200,30)), parent = desktop2, text = "Resume Game",style = self.button_style)
            self.resume_button.onClick = self.resume

        #self.resume_button = gui.Button(position = threades.resize_pos((500,550)), size = threades.resize_pos((200,30)), parent = threades.desktop, text = "Resume Game",style = self.button_style)
        self.controls_button = gui.Button(position = threades.resize_pos((500,600)), size = threades.resize_pos((200,30)), parent = desktop2, text = "Controls",style = self.button_style)
        self.exit_button = gui.Button(position = threades.resize_pos((500,650)), size = threades.resize_pos((200,30)), parent = desktop2, text = "Exit",style = self.button_style)
        self.instructions_button = gui.Button(position = threades.resize_pos((500,550)), size = threades.resize_pos((200,30)), parent = desktop2, text = "Guide",style = self.button_style)
        self.about_us_button = gui.Button(position = threades.resize_pos((1000,20)), size = threades.resize_pos((150,30)), parent = desktop2, text = "About Us",style = self.button_style)
        
                                      
        #self.resume_button.onClick = self.resume
        self.controls_button.onClick = self.controls
        self.exit_button.onClick = safe_exit
        
        self.instructions_button.onClick = self.instructionsWindow
        self.about_us_button.onClick = self.aboutUsWindow

        self.run = True
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:39,代码来源:Foodforce2.py


示例11: tradingWindow

    def tradingWindow(self, handle, buddyName="Friend", resource="Water", quantity="0", price="10", trade="sell"):
        """Opens the trading window at the reciever end for trading
        """

        # self.font_color = (255,214,150) # Brown
        self.replyhandle = handle
        self.replymessage = ["TradeReply", resource, quantity, price, trade]
        color_blue = (0, 0, 250)
        myfont = pygame.font.Font("font.ttf", threades.resize_pt(17))
        # Custom Window Style
        win_style = gui.defaultWindowStyle.copy()
        win_style["font"] = myfont
        win_style["bg-color"] = (0, 0, 0)
        win_style["font-color"] = color_blue

        # Calculating position and size of window from the size of the desktop
        position_win = threades.resize_pos((725.0, 42.0))
        size_win = threades.resize_pos((470.0, 180.0))

        # Creating custom label style for the text to be displayed as a message
        labelStyleCopy = gui.defaultLabelStyle.copy()
        labelStyleCopy["wordwrap"] = True
        labelStyleCopy["autosize"] = False
        labelStyleCopy["font"] = myfont
        labelStyleCopy["font-color"] = color_blue
        # labelStyleCopy['font-color'] = font_color

        self.win = gui.Window(
            position=position_win,
            size=size_win,
            parent=threades.desktop,
            text="Trade ",
            style=win_style,
            shadeable=False,
            moveable=False,
        )
        # Creating label
        label_text = (
            "\n" + buddyName + " wants to " + trade + " " + quantity + " units of " + resource + "\n at $ " + price
        )
        message_label = gui.Label(
            position=threades.resize_pos((5, 5), (470.0, 180.0), self.win.size),
            size=threades.resize_pos((460, 120), (470.0, 180.0), self.win.size),
            parent=self.win,
            text=label_text,
            style=labelStyleCopy,
        )

        # Creating button style
        myfont2 = pygame.font.Font("font.ttf", threades.resize_pt(16))
        button_style = gui.defaultButtonStyle.copy()
        button_style["font"] = myfont2

        self.button_accept = gui.Button(
            position=threades.resize_pos((100.0, 130.0), (470.0, 180.0), size_win),
            size=threades.resize_pos((100.0, 40.0), (470.0, 180.0), size_win),
            parent=self.win,
            text=" Accept ",
            style=button_style,
        )
        self.button_reject = gui.Button(
            position=threades.resize_pos((300.0, 130.0), (470.0, 180.0), size_win),
            size=threades.resize_pos((100.0, 40.0), (470.0, 180.0), size_win),
            parent=self.win,
            text=" Reject ",
            style=button_style,
        )

        self.button_accept.onClick = self.checkTrade
        self.button_reject.onClick = self.closeWin

        sleep(6)
        if self.win:
            self.win.close()
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:74,代码来源:game_sharing.py


示例12: instructionsWindow

    def instructionsWindow(self,button = None):
        ''' Opens a window for Instructions
        '''
        
        self.remove_buttons()
        self.lightgreen_color = (0,100,0)
        self.green_color = (0,150,0)
        self.black_color = (0,0,0)
        myfont1 = pygame.font.Font("font.ttf", threades.resize_pt(40))

        # Custom gui.Window Style
        win_style = gui.defaultWindowStyle.copy()
        win_style['font'] = myfont1
        win_style['font-color'] = self.green_color
        win_style['bg-color'] = (0,0,0)
        win_style['border-color'] = (0,150,0)
        
        # Calculating position and size of window from the size of the threades.desktop
        position_win =threades.resize_pos((150.0,270.0))
        size_win =threades.resize_pos((900.0,600.0))

        # Creating window
        self.win = gui.Window(position = position_win, size = size_win, parent = desktop2, text = "     Guide" , style = win_style, shadeable = False, closeable = False,moveable = False)
        self.win.onClose = lambda button: self.main_menu(self.pause_flag)
        #self.win.surf.set_alpha(140) This seems to be redundant as translucency doesnt seems to work properly

        myfont2 = pygame.font.Font("font.ttf", threades.resize_pt(20))
        labelStyleCopy = gui.defaultLabelStyle.copy()
        labelStyleCopy['border-width'] = 1
        labelStyleCopy['wordwrap'] = True
        labelStyleCopy['autosize'] = False
        labelStyleCopy['font'] = myfont2
        labelStyleCopy['font-color'] = (0,200,0)
        labelStyleCopy['border-color'] = self.black_color
        
        self.skip_button = gui.Button(position = threades.resize_pos((500,550),(900.0,600.0),self.win.size), size = threades.resize_pos((80,30),(900.0,600.0),self.win.size), parent = self.win, text = "  Skip  ",style = self.button_style)
        self.next_button = gui.Button(position = threades.resize_pos((380,550),(900.0,600.0),self.win.size), size = threades.resize_pos((80,30),(900.0,600.0),self.win.size), parent = self.win, text = "  Next > ",style = self.button_style)
        self.prev_button = gui.Button(position = threades.resize_pos((260,550),(900.0,600.0),self.win.size), size = threades.resize_pos((80,30),(900.0,600.0),self.win.size), parent = self.win, text = "  < Prev  ",style = self.button_style)

        self.next_button.onClick = self.increaseInstructionsCounter
        self.prev_button.onClick = self.decreaseInstructionsCounter
        self.skip_button.onClick = self.close_win
        self.instructions_run = True
        logo =  pygame.image.load(os.path.join('data', 'logo.png')).convert()
        ff_logo = pygame.transform.scale(logo,threades.resize_pos((1111,250)))
        
        self.instructions_counter = 0
        label = gui.Label(position = threades.resize_pos((10.0,100.0),(900.0,600.0),self.win.size),size = threades.resize_pos((880.0,440.0),(900.0,600.0),self.win.size), parent = self.win, text = '', style = labelStyleCopy)

        while self.instructions_run:
            pygame.display.set_caption('FoodForce2')
            threades.screen.fill((0,0,0))
            threades.screen.blit(ff_logo,threades.resize_pos((40,50)))

            label.text = texts.instruction_text[self.instructions_counter]
            for e in gui.setEvents(pygame.event.get()):
                if e.type == KEYDOWN:
                    if e.key == 27:  # For escape key
                        self.instructions_run = False
                        self.win.close()
                    if e.key == K_RIGHT:
                        if self.instructions_counter < len(texts.instruction_text)-1:
                            self.instructions_counter += 1
                    if e.key == K_LEFT:
                        if self.instructions_counter > 0 :
                            self.instructions_counter -= 1

            desktop2.update()
            desktop2.draw()
            pygame.display.update()
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:70,代码来源:Foodforce2.py


示例13: controls

    def controls(self,button = None):
        """"show controllers
        """
        self.remove_buttons()
        self.lightgreen_color = (0,100,0)
        self.green_color = (0,150,0)
        self.black_color = (0,0,0)
        myfont1 = pygame.font.Font("font.ttf", threades.resize_pt(40))

        # Custom gui.Window Style
        win_style = gui.defaultWindowStyle.copy()
        win_style['font'] = myfont1
        win_style['font-color'] = self.green_color
        win_style['bg-color'] = (0,0,0)
        win_style['border-color'] = (0,150,0)
        # Calculating position and size of window from the size of the threades.desktop
        position_win =threades.resize_pos((150.0,270.0))
        size_win =threades.resize_pos((900.0,600.0))

        # Creating window
        self.win = gui.Window(position = position_win, size = size_win, parent = desktop2, text = "     Controls " , style = win_style, shadeable = False, closeable = False)
        self.win.onClose = lambda button: self.main_menu(self.pause_flag)
        self.win.surf.set_alpha(140)

        control_text = """\n\n  Setup Facility           :       s \n\n  Upgrade Facility       :       u \n\n  Buy/Sell                    :       b \n\n  Scroll threades.screen up       :       up arrow \n\n  Scroll threades.screen down   :       down arrow \n\n  Scroll threades.screen left      :       left arrow \n\n  Scroll threades.screen right    :       right arrow """
        myfont2 = pygame.font.Font("font.ttf", threades.resize_pt(25))
        labelStyleCopy = gui.defaultLabelStyle.copy()
        labelStyleCopy['border-width'] = 1
        labelStyleCopy['wordwrap'] = True
        labelStyleCopy['autosize'] = False
        labelStyleCopy['font'] = myfont2
        labelStyleCopy['font-color'] = self.lightgreen_color
        labelStyleCopy['border-color'] = self.black_color
        self.message_label = gui.Label(position = threades.resize_pos((80,80),(600.0,600.0),self.win.size),size = threades.resize_pos((240,70),(600.0,600.0),self.win.size), parent = self.win, text = "Setup Facility ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((80,130),(600.0,600.0),self.win.size),size = threades.resize_pos((240,70),(600.0,600.0),self.win.size), parent = self.win, text = "Upgrade Facility ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((80,180),(600.0,600.0),self.win.size),size = threades.resize_pos((240,70),(600.0,600.0),self.win.size), parent = self.win, text = "Buy/Sell ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((80,230),(600.0,600.0),self.win.size),size = threades.resize_pos((240,70),(600.0,600.0),self.win.size), parent = self.win, text = "Scroll Screen up ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((80,280),(600.0,600.0),self.win.size),size = threades.resize_pos((240,70),(600.0,600.0),self.win.size), parent = self.win, text = "Scroll Screen down", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((80,330),(600.0,600.0),self.win.size),size = threades.resize_pos((240,70),(600.0,600.0),self.win.size), parent = self.win, text = "Scroll Screen left ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((80,380),(600.0,600.0),self.win.size),size = threades.resize_pos((240,70),(600.0,600.0),self.win.size), parent = self.win, text = "Scroll Screen right ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((80,430),(600.0,600.0),self.win.size),size = threades.resize_pos((240,70),(600.0,600.0),self.win.size), parent = self.win, text = "Focus ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((80,480),(600.0,600.0),self.win.size),size = threades.resize_pos((240,70),(600.0,600.0),self.win.size), parent = self.win, text = "De Focus ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((330,80),(600.0,600.0),self.win.size),size = threades.resize_pos((10,70),(600.0,600.0),self.win.size), parent = self.win, text = ": ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((330,130),(600.0,600.0),self.win.size),size = threades.resize_pos((10,70),(600.0,600.0),self.win.size), parent = self.win, text = ": ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((330,180),(600.0,600.0),self.win.size),size = threades.resize_pos((10,70),(600.0,600.0),self.win.size), parent = self.win, text = ": ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((330,230),(600.0,600.0),self.win.size),size = threades.resize_pos((10,70),(600.0,600.0),self.win.size), parent = self.win, text = ": ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((330,280),(600.0,600.0),self.win.size),size = threades.resize_pos((10,70),(600.0,600.0),self.win.size), parent = self.win, text = ": ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((330,330),(600.0,600.0),self.win.size),size = threades.resize_pos((10,70),(600.0,600.0),self.win.size), parent = self.win, text = ": ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((330,380),(600.0,600.0),self.win.size),size = threades.resize_pos((10,70),(600.0,600.0),self.win.size), parent = self.win, text = ": ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((330,430),(600.0,600.0),self.win.size),size = threades.resize_pos((10,70),(600.0,600.0),self.win.size), parent = self.win, text = ": ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((330,480),(600.0,600.0),self.win.size),size = threades.resize_pos((10,70),(600.0,600.0),self.win.size), parent = self.win, text = ": ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((350,80),(600.0,600.0),self.win.size),size = threades.resize_pos((240,70),(600.0,600.0),self.win.size), parent = self.win, text = "s ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((350,130),(600.0,600.0),self.win.size),size = threades.resize_pos((240,70),(600.0,600.0),self.win.size), parent = self.win, text = "u ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((350,180),(600.0,600.0),self.win.size),size = threades.resize_pos((240,70),(600.0,600.0),self.win.size), parent = self.win, text = "b ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((350,230),(600.0,600.0),self.win.size),size = threades.resize_pos((240,70),(600.0,600.0),self.win.size), parent = self.win, text = "up arrow ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((350,280),(600.0,600.0),self.win.size),size = threades.resize_pos((240,70),(600.0,600.0),self.win.size), parent = self.win, text = "down arrow ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((350,330),(600.0,600.0),self.win.size),size = threades.resize_pos((240,70),(600.0,600.0),self.win.size), parent = self.win, text = "left arrrow ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((350,380),(600.0,600.0),self.win.size),size = threades.resize_pos((240,70),(600.0,600.0),self.win.size), parent = self.win, text = "right arrow ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((350,430),(600.0,600.0),self.win.size),size = threades.resize_pos((240,70),(600.0,600.0),self.win.size), parent = self.win, text = "f ", style = labelStyleCopy)
        self.message_label = gui.Label(position = threades.resize_pos((350,480),(600.0,600.0),self.win.size),size = threades.resize_pos((240,70),(600.0,600.0),self.win.size), parent = self.win, text = "d ", style = labelStyleCopy)

        self.win.surf.set_alpha(255)
        self.ok_button = gui.Button(position = threades.resize_pos((480,550),(600.0,600.0),self.win.size), size = threades.resize_pos((80,30),(600.0,600.0),self.win.size), parent = self.win, text = "  OK  ",style = self.button_style)

        self.ok_button.onClick = self.close_win
        self.controls_run = True
        logo =  pygame.image.load(os.path.join('data', 'logo.png')).convert()
        ff_logo = pygame.transform.scale(logo,threades.resize_pos((1111,250)))
        while self.controls_run:
            pygame.display.set_caption('FoodForce2')
            threades.screen.fill((0,0,0))
            threades.screen.blit(ff_logo,threades.resize_pos((40,50)))

            for e in gui.setEvents(pygame.event.get()):
                if e.type == KEYDOWN:
                    if e.key == 27:  # For escape key
                        self.controls_run = False
                        self.win.close()

                if e.type==mesh.CONNECT :
                    game_sharing.sharing_handler(e.type,None,'')
                #sharing_thread = threading.Thread(target = game_sharing.sharing_handler, args=[e.type,None,'']).start()
                elif e.type==mesh.PARTICIPANT_ADD or e.type==mesh.PARTICIPANT_REMOVE :
                    game_sharing.sharing_handler(e.type,e.handle,'')
                #sharing_thread = threading.Thread(target = game_sharing.sharing_handler, args=[e.type,e.handle,'']).start()
                elif e.type==mesh.MESSAGE_MULTI or e.type==mesh.MESSAGE_UNI :
                    game_sharing.sharing_handler(e.type,e.handle,e.content)
                #sharing_thread = threading.Thread(target = game_sharing.sharing_handler, args=[e.type,e.handle,e.content]).start()

                
            desktop2.update()
            desktop2.draw()
            pygame.display.update()
开发者ID:deveshmittal,项目名称:FoodForce2012,代码行数:93,代码来源:Foodforce2.py


示例14: startup_text

    def startup_text(self,button = None):
        ''' Displays the startup text
        '''

        self.remove_buttons()
        threades.screen.fill((255,255,255))
        hunger_map = pygame.image.load(os.path.join('data', 'Wfpwork.png')).convert()
        hunger_map =  pygame.transform.scale(hunger_map,threades.new_screen_size)
        threades.screen.blit(hunger_map,threades.resize_pos((0,0)))

        color_brown = (255,214,150)
        # gui.Window custom style
        myfont = pygame.font.Font("font.ttf", threades.resize_pt(28))
        win_style = gui.defaultWindowStyle.copy()
        win_style['font'] = myfont
        win_style['font-color'] = color_brown
        win_style['bg-color'] = (0,0,0)
        win_style['border-color'] = color_brown
        position_win =threades.resize_pos((200.0,50.0))
        size_win =threades.resize_pos((800.0,600.0))
        win = gui.Window(position = position_win, 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python threadframe.dict函数代码示例发布时间:2022-05-27
下一篇:
Python threades.resize_pos函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap