当前位置: 首页>>代码示例>>Python>>正文


Python simpleguitk.create_frame函数代码示例

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


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

示例1: setupGUI

def setupGUI():
	"""
	Setup frame and other control objects for GUI
	"""
	global Frame,txtCurrentHeading,txtDesiredHeading,txtThrottle,txtRudder,btnCircle,btnJoystickControl

	#Frame	
	Frame =  gui.create_frame('Minnow Simulator', width, height)
	Frame.set_draw_handler(drawHandler)

	#========Text Boxes =====================================
	txtCurrentHeading = Frame.add_input("Current Heading",txtHandler,100)
	txtDesiredHeading = Frame.add_input("Desired Heading",txtHandler,100)
	txtThrottle = Frame.add_input("Throttle Value",txtHandler,100)
	txtRudder = Frame.add_input("Rudder Value",txtHandler,100)

	#======= Buttons ==============================================
	btnNorth = Frame.add_button("North",northHandler,50)
	btnSouth = Frame.add_button("South",southHandler,50)
	btnEast = Frame.add_button("East",eastHandler,50)
	btnWest = Frame.add_button("West",westHandler,50)

	lblCircle = Frame.add_label('Move_Circle')
	btnCircleStart = Frame.add_button("start",circleStartHandler,25)

	#====== Joystick Control =====================================================
	lblJoystickControl = Frame.add_label('Joystick_Control')
	btnJoystickControl = Frame.add_button("ON",joyControlHandler,50)
开发者ID:monica-p,项目名称:YorkU-Minnow,代码行数:28,代码来源:user_interface.py

示例2: demo2

def demo2():
    # Create a frame and assign callbacks to event handlers
    frame = simplegui.create_frame("Home", 300, 200)
    frame.add_button("Click me", click)
    frame.set_draw_handler(draw)
    
    # Start the frame animation
    frame.start()
开发者ID:tdongsi,项目名称:python,代码行数:8,代码来源:SimpleGuiDemo.py

示例3: __init__

 def __init__(self):
     """ 
     Initializer to create frame, sets handlers and initialize list of balls to be empty
     """
     self.simulation = Simulation()
     self._frame = simplegui.create_frame("ball/ball collision simulator", 
                                         CANVAS_WIDTH, CANVAS_HEIGHT)
     self._frame.set_draw_handler(self.draw)
     self._frame.set_mouseclick_handler(self.click)
     self._prev_time = time.time()
     self._frame_rate = 60.0
开发者ID:novneetnov,项目名称:Principles-Of-Computing---II,代码行数:11,代码来源:poc_physics_linear.py

示例4: __init__

 def __init__(self):
     """
     Create a frame and load the cancer data
     """
     self._frame = simplegui.create_frame("Cancer risk visualization", CANVAS_WIDTH, CANVAS_HEIGHT)
     self._frame.set_canvas_background("White")
     self._frame.set_draw_handler(self.draw)
     self._frame.add_input("Enter cutoff (scaled by 0.00001)", self.enter_cutoff, 200)
     self._frame.add_button("Print data table in CSV", self.print_table, 200)
     self._data_table = self.load_data()
     self.enter_cutoff("0.0")
     self._USA_Counties = simplegui.load_image(MAP_URL)
     self._frame.start()
开发者ID:GauravKataria,项目名称:Algorithmic_Thinking_Coursera,代码行数:13,代码来源:user38_counties_simplegui_0.py

示例5: setup_frame

 def setup_frame(self):
     """
     Create GUI frame and add handlers.
     """
     self._frame = simplegui.create_frame("Tic-Tac-Toe",
                                          GUI_WIDTH,
                                          GUI_HEIGHT)
     self._frame.set_canvas_background('White')
     
     # Set handlers
     self._frame.set_draw_handler(self.draw)
     self._frame.set_mouseclick_handler(self.click)
     self._frame.add_button("New Game", self.newgame)
     self._label = self._frame.add_label("")
开发者ID:chrisnatali,项目名称:minimax,代码行数:14,代码来源:poc_ttt_gui.py

示例6: createWorld

    def createWorld(self):
        world = gui.create_frame("Robot World",self.worldX,self.worldY)
        world.set_canvas_background(GUI.WORLD_COLOR)

        self.txtSetDist = world.add_input("Set Distance", self.txtDestDistance,50)
        self.btnSetDist = world.add_button("Set Distance",self.setDistHandler,50)
        self.btnMove = world.add_button("Move",self.moveHandler, 50)

        timer = gui.create_timer(500,self.timerHandler)

        world.set_draw_handler(self.renderingHandler)

        timer.start()  
        world.start()
开发者ID:monica-p,项目名称:YorkU-Minnow,代码行数:14,代码来源:GUI.py

示例7: __init__

 def __init__(self, wildfire):
     """ 
     Create frame and timers, register event handlers
     """
     self._fire = wildfire
     self._grid_height = self._fire.get_grid_height()
     self._grid_width = self._fire.get_grid_width()
     self._frame = simplegui.create_frame("Interactive BFS demo", 
                                         self._grid_width * CELL_SIZE, self._grid_height * CELL_SIZE)
     self._frame.set_canvas_background("White")
     self._frame.add_button("Clear all", self.clear, 100)
     self._frame.add_button("Step", self.step, 100)
     self._frame.add_button("Ten steps", self.ten_steps, 100)
     self._frame.set_mouseclick_handler(self.add_cell_index)
     self._frame.set_draw_handler(self.draw)
开发者ID:novneetnov,项目名称:Principles-Of-Computing---II,代码行数:15,代码来源:poc_wildfire_gui_bfs.py

示例8: createFrame

def createFrame():
    global FRAME_WIDTH, FRAME_HEIGHT
    
    FRAME_NAME = 'Stopwatch - THE GAME'
    
    #create frame
    frame = simplegui.create_frame(FRAME_NAME, FRAME_WIDTH, FRAME_HEIGHT)
    
    #add buttons to frame
    frame = addButtons(frame)
    
    #register frame event handlers
    frame = setEventHandlers(frame)
    
    return frame
开发者ID:CardenB,项目名称:pyGames,代码行数:15,代码来源:StopWatchGame.py

示例9: __init__

 def __init__(self, game):
     self._game = game
     self._rows = game.get_grid_height()
     self._cols = game.get_grid_width()
     self._frame = simplegui.create_frame('2048',
                     self._cols * TILE_SIZE + 2 * BORDER_SIZE,
                     self._rows * TILE_SIZE + 2 * BORDER_SIZE)
     self._frame.add_button('New Game', self.start)
     self._frame.set_keydown_handler(self.keydown)
     self._frame.set_draw_handler(self.draw)
     self._frame.set_canvas_background("#BCADA1")
     self._tiles = simplegui.load_image(IMAGE_URL)
     self._directions = {"up": UP, "down": DOWN,
                         "left": LEFT, "right": RIGHT}
     self._frame.start()
开发者ID:lingchunkai,项目名称:2048_ai,代码行数:15,代码来源:poc_2048_gui.py

示例10: __init__

 def __init__(self, game):
     self._cols = game.get_grid_height()
     self._rows = game.get_grid_width()
     self._frame = simplegui.create_frame(
         "2048", self._rows * TILE_SIZE + 2 * BORDER_SIZE, self._cols * TILE_SIZE + 2 * BORDER_SIZE
     )
     self._frame.add_button("New Game", self.start)
     self._frame.set_keydown_handler(self.keydown)
     self._frame.set_draw_handler(self.draw)
     self._frame.set_canvas_background("#A39480")
     self._frame.start()
     self._game = game
     url = "http://codeskulptor-assets.commondatastorage.googleapis.com/assets_2048.png"
     self._tiles = simplegui.load_image(url)
     self._directions = {"up": UP, "down": DOWN, "left": LEFT, "right": RIGHT}
开发者ID:romperstomper,项目名称:pc,代码行数:15,代码来源:poc_2048_gui.py

示例11: __init__

    def __init__(self, game):
        """
        Initializer to create frame, sets handlers and initialize game
        """
        self._frame = simplegui.create_frame("Mancala Solitaire",
                                             CANVAS_SIZE[0], CANVAS_SIZE[1])
        self._frame.set_canvas_background("White")
        self._frame.set_draw_handler(self.draw)
        self._frame.add_button("New board", self.new_board, 200)
        self._frame.add_button("Restart board", self.restart_board, 200)
        self._frame.add_button("Make move", self.make_move, 200)
        self._frame.set_mouseclick_handler(self.click_move)

        # fire up game and frame
        self._game = game
        self.new_board()
开发者ID:perfectgait,项目名称:simple_mancala,代码行数:16,代码来源:poc_mancala_gui.py

示例12: __init__

 def __init__(self):
     """
     Initialize the simulation
     """
     self._frame = simplegui.create_frame("Monty Hall problem", CANVAS_WIDTH, 
                                          CANVAS_HEIGHT, CONTROL_WIDTH)
     self._frame.set_canvas_background("White")
     self._frame.add_button("Clear", self.clear, CONTROL_WIDTH)
     self._frame.add_button("Add door", self.add_door, CONTROL_WIDTH)
     self._frame.set_mouseclick_handler(self.click)
     self._frame.add_label("")
     self._win_label = self._frame.add_label("Wins = 0")
     self._lose_label = self._frame.add_label("Loses = 0")
     self.clear()
     self._frame.set_draw_handler(self.draw)
     self._frame.start()
开发者ID:novneetnov,项目名称:Principles-Of-Computing---I,代码行数:16,代码来源:monty_hall_gui.py

示例13: __init__

    def __init__(self, puzzle):
        """
        Create frame and timers, register event handlers
        """
        self._puzzle = puzzle
        self._puzzle_height = puzzle.get_height()
        self._puzzle_width = puzzle.get_width()

        self._frame = simplegui.create_frame("The Fifteen puzzle",
                                             self._puzzle_width * TILE_SIZE,
                                             self._puzzle_height * TILE_SIZE)
        self._solution = ""
        self._current_moves = ""
        self._frame.add_button("Solve", self.solve, 100)
        self._frame.add_input("Enter moves", self.enter_moves, 100)
        self._frame.add_button("Print moves", self.print_moves, 100)
        self._frame.set_draw_handler(self.draw)
        self._frame.set_keydown_handler(self.keydown)
        self._timer = simplegui.create_timer(50, self.tick)
        self._timer.start()
        self._frame.start()
开发者ID:flail-monkey,项目名称:principles1,代码行数:21,代码来源:poc_fifteen_gui.py

示例14: __init__

    def __init__(self, simulation):
        """
        Create frame and timers, register event handlers
        """
        self._simulation = simulation
        self._grid_height = self._simulation.get_grid_height()
        self._grid_width = self._simulation.get_grid_width()
        self._frame = simplegui.create_frame("Zombie Apocalypse simulation",
                                             self._grid_width * CELL_SIZE,
                                             self._grid_height * CELL_SIZE)
        self._frame.set_canvas_background("White")
        self._frame.add_button("Clear all", self.clear, 200)
        self._item_type = OBSTACLE

        label = LABEL_STRING + NAME_MAP[self._item_type]
        self._item_label = self._frame.add_button(label,
                                                  self.toggle_item, 200)
        self._frame.add_button("Humans flee", self.flee, 200)
        self._frame.add_button("Zombies stalk", self.stalk, 200)
        self._frame.set_mouseclick_handler(self.add_item)
        self._frame.set_draw_handler(self.draw)
开发者ID:chrisnatali,项目名称:zombie,代码行数:21,代码来源:poc_zombie_gui.py

示例15: __init__

    def __init__(self, game):
        """ 
        Create frame and timers, register event handlers
        """
        self.game = game
        self.frame = simplegui.create_frame("Word Wrangler", 
                                            CANVAS_WIDTH, CANVAS_HEIGHT, 250)
        self.frame.set_canvas_background("Blue")        
               
        self.enter_input = self.frame.add_input("Enter word for new game", 
                                                self.enter_start_word, 250)
        labelmsg = "Stars correspond to hidden words formed using letters "
        labelmsg += "from the entered word. Hidden words are listed in alphabetical order"
        self.frame.add_label(labelmsg, 250)
        self.frame.add_label("", 250)
        self.guess_label = self.frame.add_input("Enter a word", 
                                                self.enter_guess, 250)       
        self.frame.add_label("For a hint, click on a starred word", 250)
        self.frame.set_mouseclick_handler(self.peek)
        self.frame.set_draw_handler(self.draw)

        self.enter_input.set_text("python")
        self.game.start_game("python")
开发者ID:flail-monkey,项目名称:principles1,代码行数:23,代码来源:poc_wrangler_gui.py


注:本文中的simpleguitk.create_frame函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。