예제 #1
0
def test_canvas_flip_horizontally():
    canvas = Canvas(2, 1)
    canvas.paint_pixel(0, 0, red)
    canvas.paint_pixel(1, 0, blue)
    canvas.select(0, 0, 1, 0)
    canvas.flip_horizontally()
    assert canvas.pixels[0][0] == blue
예제 #2
0
 def _import_txt_triggered(self):
     path = QFileDialog.getOpenFileName(self)[0]
     self._mesh = FileHandler.load_mesh(path)
     self._width.setText(str(self._mesh.get_size().width()))
     self._height.setText(str(self._mesh.get_size().height()))
     self._canvas = Canvas(self.get_canvas__geometry(), self._mesh)
     self._canvas.show()
예제 #3
0
def test_canvas_flip_vertically():
    canvas = Canvas(1, 2)
    canvas.paint_pixel(0, 0, red)
    canvas.paint_pixel(0, 1, blue)
    canvas.select(0, 0, 0, 1)
    canvas.flip_vertically()
    assert canvas.pixels[0][0] == blue
예제 #4
0
    def test_adjust_axes_2(self):
        '''
        load 'clt.nc', load 'u' variable, load 'v' variable, adjust sliders, load, and plot.
        '''
        print("\n\n...test_adjust_axes_2...")

        left_side_bar = self.load_data_file("clt.nc")

        load_variable_pop_up = LoadVariablePopUp(self.driver)
        load_variable_pop_up.click_on_var('u')
        load_variable_pop_up.click_on_var_axes('u')
        # adjust the min slider by 20 percent and max slider by 20 percent.
        load_variable_pop_up.adjust_var_axes_slider('u', 'longitude1', 20, -20)

        load_variable_pop_up.click_on_var('v')
        load_variable_pop_up.click_on_var_axes('v')
        # adjust the min slider by 20 percent and max slider by 20 percent.
        load_variable_pop_up.adjust_var_axes_slider('v', 'longitude2', 20, -20)

        load_variable_pop_up.load()
        left_side_bar.select_plot_type("streamline (default)")

        left_side_bar.click_on_plot()
        canvas = Canvas(self.driver)
        canvas.check_plot()
예제 #5
0
def test_canvas_rect():
    print(inspect.currentframe().f_code.co_name)
    c = Canvas(10, 10, 0)

    blue = Color(0, 0, 255)

    c.draw_rect(2, 2, 4, 4, blue)
    print(repr(c))
예제 #6
0
 def _gen_space_btn_clicked(self):
     width = int(self._width.text())
     height = int(self._height.text())
     if self._canvas:
         self._canvas.close()
     self._mesh = Mesh(width, height, PROB)
     self._canvas = Canvas(self.get_canvas__geometry(), self._mesh)
     self._canvas.show()
예제 #7
0
 def draw(self, canvas: Canvas):
     if self.client_data is not None:
         for x in range(0, canvas.width):
             for y in range(0, canvas.height):
                 color = Color(self.client_data[x][y][0],
                               self.client_data[x][y][1],
                               self.client_data[x][y][2])
                 canvas.draw_pixel(x, y, color)
예제 #8
0
 def __init__(self):
     self.canvas = Canvas(self)
     self.p1 = Circle(pos=[0, 0.8, 0], radius=0.2, color=[1, 0, 0])
     self.p2 = Circle(pos=[0, -0.8, 0], radius=0.2, color=[0, 0, 1])
     self.ball = Circle(pos=[0, 0, 0], radius=0.1, color=[0, 1, 1])
     # self.canvas = canvas
     self.movePuck = False
     self.deg = 0
예제 #9
0
def test_turn_right():
    canvas = Canvas(3, 3)
    canvas.paint_pixel(1, 0)
    canvas.paint_pixel(1, 1)
    canvas.paint_pixel(1, 2)
    canvas.select(0, 0, 2, 2)
    canvas.turn_selection_right()
    assert canvas.pixels[0][1] == canvas.current_color
예제 #10
0
 def draw(self, canvas: Canvas):
     for x in range(0, canvas.width):
         for y in range(0, canvas.height):
             if self.game_board[x][y] is True:
                 c = Color(self.colorboard[x][y][0],
                           self.colorboard[x][y][1],
                           self.colorboard[x][y][2])
                 canvas.draw_pixel(x, y, c)
예제 #11
0
class CryptoExchangeGraph(QWidget):
    def __init__(self, defaultCrypto='BTC', defaultExchange='USD'):
        super().__init__()

        self.setAutoFillBackground(True)

        fontSize = 10

        cryptoX = 320
        cryptoY = 30
        cryptoWidth = 70
        cryptoHeight = 25

        horizontalTextBoxSpace = 30

        exchangeX = cryptoX + cryptoWidth + horizontalTextBoxSpace
        exchangeY = cryptoY + cryptoHeight + 25
        exchangeWidth = cryptoWidth
        exchangeHeight = cryptoHeight

        self.canvas = Canvas(self)
        self.canvas.move(0, 0)
        self.canvas.resize(315, 300)

        labelWidth = 30
        labelCrypto = QLabel(self)
        labelCrypto.setText('Crypto')
        labelCrypto.move(cryptoX + (cryptoWidth - labelWidth) / 2.5,
                         cryptoY - 20)

        labelExchange = QLabel(self)
        labelExchange.setText('Exchange')
        labelExchange.move(cryptoX + (cryptoWidth - labelWidth) / 2.5 - 2,
                           exchangeY - 20)

        self.cryptoTextBox = TextBox(self,
                                     defaultText=defaultCrypto,
                                     placeholder='Crypto',
                                     fontSize=fontSize,
                                     x=cryptoX,
                                     y=cryptoY,
                                     width=cryptoWidth,
                                     height=cryptoHeight)
        self.exchangeTextBox = TextBox(self,
                                       defaultText=defaultExchange,
                                       placeholder='Exchange',
                                       fontSize=fontSize,
                                       x=cryptoX,
                                       y=exchangeY,
                                       width=cryptoWidth,
                                       height=exchangeHeight)

        buttonGo = QPushButton('Go', self)
        buttonGo.move(cryptoX - 2, exchangeY + exchangeHeight + 20)
        buttonGo.clicked.connect(self.updateGraph)

    def updateGraph(self):
        print('ohayo')
예제 #12
0
def test_canvas_pixel_line():
    print(inspect.currentframe().f_code.co_name)
    c = Canvas(10, 10, 0)

    blue = Color(0, 0, 255)

    for i in range(c.width - 1, 0 - 1, -1):
        c.draw_pixel(9 - i, i, blue)
        print(repr(c))
예제 #13
0
 def clear_btn_clicked(self):
     width = int(self._width.text())
     height = int(self._height.text())
     prob_rule4 = int(self._prob_rule4.text())
     self._mesh = Mesh(width, height, prob_rule4)
     self._canvas.close()
     self._canvas = Canvas(self.get_canvas__geometry(), self._mesh)
     self._canvas.show()
     self._canvas.repaint()
예제 #14
0
def generate(
        course_name, quiz_number, output_dir, template_file, recipients_file, token_file, s
):
    """Driver/interface function for generating a report.
    """
    # Create directories if needed
    figures_dir = Path(output_dir / "figures")
    for d in [output_dir, figures_dir]:
        export.create_dir(d)

    # Use a stale dataset, or grab a fresh one
    if s is True:
        print("Loading contents from file...")
        with open("contents.json", "r") as f:
            contents = json.load(f)
    else:
        print("Fetching data from Canvas...")
        with token_file.open("r") as f:
            token = f.read()
        c = Canvas("asu.instructure.com", "v1", token)
        report_df = c.get_quiz_report(course_name, quiz_number)
        print("Fetch complete.")
        contents = data_processing.generate_report_contents(
            c, report_df, quiz_number, figures_dir, recipients_file
        )
        with open("contents.json", "w+") as f:
            json.dump(contents, f)

    # Render LaTeX template
    print("Rendering LaTeX Template...")
    env = make_env(loader=FileSystemLoader(str(template_file.parent)))
    tpl = env.get_template(str(template_file.name))
    rendered_latex = tpl.render(contents=contents)
    print("Render complete.")

    # Typeset PDF
    print("Typesetting PDF...")
    base_filename = f"muddy_points_{contents.get('quiz_number')}"
    pdf_filename = Path(output_dir / f"{base_filename}.pdf")
    pdf = build_pdf(rendered_latex, texinputs=[str(Path.cwd()), ""])
    pdf.save_to(str(pdf_filename))
    print("Typesetting complete.")

    # Export to Microsoft Word and LaTeX formats for further editing
    docx_filename = Path(output_dir / f"{base_filename}.docx")
    latex_filename = Path(output_dir / f"{base_filename}.tex")
    export.make_texfile(rendered_latex, latex_filename)
    export.make_docx(latex_filename, docx_filename)

    # Create archive
    print("Creating archive...")
    zip_filename = Path(output_dir / f"{base_filename}.zip")
    export.make_archive(
        zip_filename, [pdf_filename, docx_filename, latex_filename], figures_dir
    )
    print(f"Created archive: {zip_filename}")
예제 #15
0
    def open(self):
       
        fileName, _ = QFileDialog.getOpenFileName(self, "Open Geotiff File",
                 QDir.currentPath(),"tif (*.tif*);;TIFF (*.TIF*)")

        if fileName:
            dsr = gdal.Open(fileName)
            np_array = np.array(dsr.ReadAsArray())
            if np_array.shape[0]==4:
                np_array=np_array[0]
            np_array_uint8 = (np_array).astype(np.uint8)

            self.geotiffScale=dsr.GetGeoTransform()[1]
            print(self.geotiffScale)

            self.setToAllBt(True)
            width,height=dsr.RasterXSize,dsr.RasterYSize
            self.aspect=Decimal(float(height)/float(width))
            minabs=100
            if width>height:
                minh=3450
                for i in range(3450,3550,1):
                   if  abs(Decimal(i*self.aspect)-int(i*self.aspect))<minabs:
                       minabs=abs(Decimal(i*self.aspect)-int(i*self.aspect))
                       minh=i
                newHeight=minh
                newWidth=Decimal(newHeight*self.aspect)       
            else:
                minw=3450
                for i in range(3450,3550,1):
                   if  abs(Decimal(i*self.aspect)-int(i*self.aspect))<minabs:
                       minabs=abs(Decimal(i*self.aspect)-int(i*self.aspect))
                       minw=i
                newWidth=minw
                newHeight=Decimal(newWidth*self.aspect)
            self.resizeFactorWidth=Decimal(width/newWidth)
            self.resizeFactorHeight=Decimal(height/newHeight)  
            self.imageLabel =Canvas(np_array_uint8,newWidth,newHeight,self.resizeFactorWidth,self.resizeFactorHeight,self.geotiffScale)
            self.imageLabel.setScale(1)
            self.imageLabel.setMouseTracking(True)
            widget = QWidget(self)
            layout = QHBoxLayout(widget)
            self.leftScroll = Pane(
            Qt.AlignTop | Qt.AlignLeft, self)
            self.leftScroll.setWidgetResizable(True)
            self.scrollBars = {
            Qt.Vertical:  self.leftScroll.verticalScrollBar(),
            Qt.Horizontal: self.leftScroll.horizontalScrollBar()
           }
            self.leftScroll.addWidget(self.imageLabel)
            self.scaleFactor = 1.0
            layout.addWidget(self.leftScroll)

            self.setCentralWidget(widget)
            self.imageLabel.update()
            self.ruler.setEnabled(True)
예제 #16
0
    def __init__(self, parent, ID):
        Canvas.__init__(self, parent, ID)
        
        self._importer = edef.Importer()
        
        self._selected_object = None

        self.Bind( Events.EVT_CAN_RCLICK, self.OnConRightClick)
        self.Bind( Events.EVT_CAN_RCLICK, self.OnModRightClick)
        self.Bind( Events.EVT_CAN_CONNECT, self.OnCanConnect)
예제 #17
0
def test_canvas_draw_pixel_line(serial):
    print(inspect.currentframe().f_code.co_name)
    c = Canvas(156, 1, 0)

    blue = Color(0, 0, 255)

    while True:
        for i in range(c.width):
            c.draw_pixel(i, 0, blue)
            serial.update(c.get_buffer_for_arduino())
예제 #18
0
파일: UI.py 프로젝트: liboyang19/stamp_fold
 def __init__(self, master=None):
     super().__init__(master)
     self.master = master
     self.pack()
     self.interface = Canvas(self)
     # Basic parameters.
     self.room_height = 0
     self.room_width = 0
     # Draw_surface
     self.draw_interface()
     # Generate room
     self.generate_room()
예제 #19
0
 def delObject(self, obj):
     if isinstance(obj, emModule):
         self._logger.debug("Delete module: %s"%id(obj))
         cons  = self.getConnectionsFrom(obj)
         for con in self.getConnectionsTo(obj):
             if not con in cons: cons.append(con)
         for con in cons: self.delObject( con )
     else:
         self._logger.debug("Delete non-module: %s"%id(obj))
         
     Canvas.delObject( self, obj )
     self.OnModified()   #
예제 #20
0
 def __init__(self, app):
     super().__init__()
     self._app = app
     MainWindow.geometry = QRect(app.desktop().screenGeometry().width() - MENU_WIDTH, 300, MENU_WIDTH, MENU_HEIGHT)
     self._init_ui()
     self._started = False
     self._mesh = Mesh(DEF_POINTS_SIZE.width(), DEF_POINTS_SIZE.height(), PROB)
     self._canvas = Canvas(self.get_canvas__geometry(), self._mesh)
     self._nhood = NHOODS[0]
     self._periodic = False
     self._canvas.show()
     self._thread = None
예제 #21
0
    def __init__(self):
        Canvas.__init__(self, 300, 300)
        self.sun = CanvasImage('images/sun.png')
        self.moon = CanvasImage('images/moon.png')
        self.earth = CanvasImage('images/earth.png')

        self.loader = ImageLoadListener()
        self.loader.add(self.sun)
        self.loader.add(self.moon)
        self.loader.add(self.earth)

        self.isActive = True
        self.onTimer()
예제 #22
0
 def __init__(self):
     Canvas.__init__(self, 300, 300)     
     self.sun = CanvasImage('images/sun.png')
     self.moon = CanvasImage('images/moon.png')
     self.earth = CanvasImage('images/earth.png')
     
     self.loader = ImageLoadListener()
     self.loader.add(self.sun)
     self.loader.add(self.moon)
     self.loader.add(self.earth) 
     
     self.isActive = True
     self.onTimer()
예제 #23
0
 def draw(self, canvas: Canvas, clear: bool = False):
     """
     Draw the font pixels to the screen.
     
     :param canvas: the canvas to be drawn to 
     :param clear: if True, the canvas will be cleared before drawing the font
     """
     if clear:
         canvas.clear()
     if self.rendered_text is not None:
         self.current_text_width = canvas.draw_text(self.rendered_text,
                                                    int(self.current_x),
                                                    int(self.current_y),
                                                    self.current_color)
예제 #24
0
파일: WormArea.py 프로젝트: Peaker/pyun
class WormArea(object):
    def __init__(self, game, surface):
        self.game = game
        self.surface = surface
        slot_length = self.game.net_config.DIAMETER*4
        self.canvas = Canvas(config.WORM_AREA_SIZE, (slot_length, slot_length))
        self.clear()
        self.differential_draw_allowed = False

    def clear(self):
        self.canvas.clear()
        self.surface.fill(config.CLEAR_COLOR)

    def draw_circle(self, color, position, diameter):
        x, y = position
        pygame.draw.circle(self.surface, color, map(int, position), diameter/2)

    def undraw_circle(self, position, diameter):
        self.draw_circle(config.CLEAR_COLOR, position, diameter)

    def show_circle(self, sqr_distance, circle):
        if circle in self.min_circles_sqr_distance:
            if sqr_distance >= self.min_circles_sqr_distance[circle]:
                return
        self.min_circles_sqr_distance[circle] = sqr_distance

    def draw(self):
        if self.game.net_config.FOG_ENABLED:
            self.min_circles_sqr_distance = {}
            self.surface.fill(config.CLEAR_COLOR)
            for player in self.game.all_players():
                player.worm.show()
            sqr_fog_radius = (self.game.net_config.FOG_VISION_DIAMETER/2)**2
            for circle, sqr_distance in self.min_circles_sqr_distance.iteritems():
                relative_distance = min(1.0, (1.0*sqr_distance/sqr_fog_radius))
                fade_color = [c*(1.0-relative_distance)
                              for c in circle.worm().color]
                self.draw_circle(fade_color, circle.position, circle.diameter)
            del self.min_circles_sqr_distance
            self.differential_draw_allowed = False
        else:
            if self.differential_draw_allowed:
                for player in self.game.all_players():
                    player.worm.draw_differentially()
            else:
                for player in self.game.all_players():
                    player.worm.draw_full()
                self.differential_draw_allowed = True
예제 #25
0
파일: WormArea.py 프로젝트: Peaker/pyun
 def __init__(self, game, surface):
     self.game = game
     self.surface = surface
     slot_length = self.game.net_config.DIAMETER*4
     self.canvas = Canvas(config.WORM_AREA_SIZE, (slot_length, slot_length))
     self.clear()
     self.differential_draw_allowed = False
예제 #26
0
def main():
    robot = Robot()
    canvas = Canvas()
    navigator = WaypointNavigator(robot);
    
    while True:
        navigator.navigateToWaypoint(*getWayPoint())
예제 #27
0
 def _removeAsset(self, idx):
     del self.canvasList[idx]
     self.listView.DeleteItem(idx)
     itemCount = self.listView.GetItemCount()
     if itemCount > 0:
         self.listView.Select(self.currentIndex, on=0)
         for numCanvas in [
                 n for n in sorted(self.canvasList.keys()) if n >= idx
         ]:
             self.canvasList[numCanvas - 1] = self.canvasList[numCanvas]
             del self.canvasList[numCanvas]
         [
             self.listView.SetColumnWidth(col, wx.LIST_AUTOSIZE)
             for col in (0, 1)
         ]
         if (idx == 0) or (idx >= itemCount):
             idx = 0 if itemCount > 0 else None
         else:
             idx = idx if idx < itemCount else None
         self.currentIndex = idx
         if self.currentIndex != None:
             self.listView.Select(self.currentIndex, on=1)
             self.drawCanvas(self.canvasList[self.currentIndex][0])
     else:
         self.currentIndex = None
         [
             self.listView.SetColumnWidth(col, wx.LIST_AUTOSIZE_USEHEADER)
             for col in (0, 1)
         ]
         self.drawCanvas(Canvas((0, 0)))
     return self.currentIndex
예제 #28
0
    def test_plot_variable_2(self):
        '''
        load 'clt.nc', load 'u' variable, load 'v' variable, load and plot.
        '''
        print("\n\n...test_plot_variable_2...")

        left_side_bar = self.load_data_file("clt.nc")

        load_variable_pop_up = LoadVariablePopUp(self.driver)
        load_variable_pop_up.click_on_var('u')
        load_variable_pop_up.click_on_var('v')
        load_variable_pop_up.load()

        left_side_bar.click_on_plot()

        canvas = Canvas(self.driver)
        canvas.check_plot()
def main(argv):
    print('Start Working...')
    LabelID = LoadLabelsFromFile(argv[-3])
    SubLabelID = LoadLabelsFromFile(argv[-2])
    cv2.namedWindow(winName, cv2.WINDOW_AUTOSIZE)

    caps = []
    for v in argv[:-4]:
        caps.append(LoadVideo(v))

    recordsList = ReadAllRecordsIntoList(argv[-4])
    start = 0
    if len(recordsList) != 0:
        start = recordsList[-1][0] + 1

    updateFramesFlag = False

    canvas = Canvas(2150, 900, caps, 30, 2, winName, LabelID, SubLabelID,
                    updateFramesFlag)
    canvas.DumpRecordsToFrames(recordsList)
    canvas.LoadVideos()
    test = canvas.GetFrames()
    canvas.TestFrames()

    #while start < len(test):
    #for t in test:
    #	tuplet = test[start].constructTuple()
    #	recordsList.append(tuplet)
    #	start+=1
    recordsList = canvas.ConvertFramesToSimpleList()
    if updateFramesFlag:
        WriteToFile(recordsList, argv[-4], updateFramesFlag)
    else:
        WriteToFile(recordsList, argv[-1], updateFramesFlag)
예제 #30
0
    def __init__(self, wavelength=6):
        global IMAGE_SIZE
        IMAGE_SIZE = (700, 300)

        self.im_size = np.array((700, 300))

        self.canvas = Canvas(*self.im_size)

        self.im_domain = self.canvas.getDomain()

        self.wall_pos = 20
        self.wall_width = 4

        self.slit_width = 6

        self.slit_sep = 100

        # self.slit_pos_top = (self.wall_pos, (self.im_size[1] / 2) - (self.slit_sep / 2))
        # self.slit_pos_mid = (self.wall_pos, (self.im_size[1] / 2))
        # self.slit_pos_bot = (self.wall_pos, (self.im_size[1] / 2) + (self.slit_sep / 2))

        self.num_sources = 10

        self.low_threshold = 0
        self.high_threshold = 1

        self.wavelength = wavelength

        self.amplitude = 1

        self.image_domain = Domain(0, 0, *self.im_size)

        self.incoming_domain, self.interference_domain = self.image_domain.split_vertical(
            self.wall_pos)

        self.plane_wave = PlaneWave(self.wavelength, self.amplitude,
                                    self.incoming_domain, np.array([1.0, 0.0]))

        self.barrier = Barrier(
            Domain(self.wall_pos, 0, self.wall_pos + self.wall_width,
                   IMAGE_SIZE[1]))
        self.barrier.setSlits(2, self.slit_width, self.slit_sep,
                              self.interference_domain)

        self.wave_drawer = GenericWaveDrawer()
예제 #31
0
def test_gui_canvas_display_by_line():
    print(inspect.currentframe().f_code.co_name)
    print("should print blue line bottom left to top right")
    try:
        from MatrixGraphicalDisplay import MatrixGraphicalDisplay

        c = Canvas(15, 10, 0)
        gui = MatrixGraphicalDisplay(15, 10, 0)
        blue = Color(0, 0, 255)

        for i in range(c.width - 1, 0 - 1 + (c.width - c.height), -1):
            c.draw_pixel(c.width - 1 - i, i - (c.width - c.height), blue)
            gui.update_with_canvas(c)

        time.sleep(.4)

    except ImportError:
        print("could not import tkinter, probably")
예제 #32
0
def test_gui_canvas_display_pixel_counter_up():
    print(inspect.currentframe().f_code.co_name)
    print("should print blue line from pixel 0 to 41")
    try:
        from MatrixGraphicalDisplay import MatrixGraphicalDisplay

        c = Canvas(42, 1, 0)
        gui = MatrixGraphicalDisplay(42, 1, 0, test_gui_canvas_display_by_line)
        blue = Color(0, 0, 255)

        for i in range(42):
            c.draw_pixel(i, 0, blue)
            gui.update_with_canvas(c)

            time.sleep(0.6)

    except ImportError:
        print("could not import tkinter, probably")
예제 #33
0
    def test_adjust_axes_1(self):
        '''
        load 'clt.nc', load 'u' variable, adjust slider, load, and plot.
        '''
        print("\n\n...test_adjust_axes_1...")

        left_side_bar = self.load_data_file("clt.nc")

        load_variable_pop_up = LoadVariablePopUp(self.driver)
        load_variable_pop_up.click_on_var('u')
        load_variable_pop_up.click_on_var_axes('u')

        # adjust the min slider by 20 percent and max slider by 20 percent.
        load_variable_pop_up.adjust_var_axes_slider('u', 'latitude1', 20, -20)
        load_variable_pop_up.load()
        left_side_bar.click_on_plot()
        canvas = Canvas(self.driver)
        canvas.check_plot()
def navigateThroughWaypoints(wpts):    
    
    # myLoc = wpts[0]
    canvas = Canvas()
    r = robot(wpts, canvas)
    startingLoc = r.getStartingLocation()
    
    n_wpts = len(wpts)
    
    for wp in wpts:
        canvas.drawWaypoint(wp)
    
    for i in range(n_wpts):
        myLoc = r.navigateToWaypoint(wpts[(i + 1 + startingLoc) % n_wpts])
        # myLoc = r.navigateToWaypoint_rt(wpts[(i + 1 + startingLoc) % n_wpts])
        print("At location: {0}".format(myLoc))                 
        time.sleep(1)
        print '\a'
 def __init__(self, map_height=12, map_width=12, num_of_cheese=3):
     self.map_height = map_height
     self.map_width = map_width
     self.num_of_cheese = num_of_cheese
     self.visited_cheese_pos = []
     self.visited_mouse_pos = []
     self.visited_cat_pos = []
     self.game_states = []
     self.mouse_path = []
     self.mouse_initial_pos = []
     self.random_coordinates = []
     self.generate_resources()
     self.cheese_pos.sort(key=self.compare_by_distance)
     self.game_state = GameState.BasicGameState(self.mouse.current_pos,
                                                self.cat.current_pos,
                                                self.cheese_pos)
     self.game_states.append(self.game_state)
     self.game_map = GameMap(self.game_state, map_height, map_width)
     self.canvas = Canvas(self.game_map)
예제 #36
0
 def die(self):
     self.game.state = 2
     if not self.dead:
         self.progress = 0
         self.game.finalscore = self.game.score
         self.game.finalcounts = self.game.counts[:]
         self.game.stars.append(
             Canvas(self.game, "EmptySplash", (self.game.x / 2, 0)))
         self.dead = True
         self.game.playMusic("Partners_in_Crimefighting.wav")
예제 #37
0
 def __init__(self, drawing):
     Canvas.__init__(self)
     self.drawing = drawing
예제 #38
0
 def __init__(self):
     Canvas.__init__(self, 150, 150)
     self.draw()
예제 #39
0
 def __init__(self):
     Canvas.__init__(self, 150, 150)
     self.context.translate(75,75)
     self.draw()
예제 #40
0
import sys
from Canvas import Canvas

# SET PARAMETERS

# INITIALIZE STUFF
canvas = Canvas()
message = 0

# USER MESSAGES

def printHelp () :
    print( "Flags:" )
    print( "-box   :: must enter four values corresponding to the x and y coordinates of the top left and bottom right vertices, respectively" )
    print( "-row   :: enter the row number to be filled " )
    print( "-col   :: enter the col number to be filled " )
    print( "-coord :: enter the coordinates of the pixel to be colored " )
    print( "-color :: enter the ascii character to be colored in with " )

def indexErrorMessage () :
    print( "ERROR -- USER IS A DUMBASS" )

def valueErrorMessage () :
    print( "ERROR -- BAD VALUE " )


# MAIN LOOP
while True:

    # DRAWING
    canvas.draw()
예제 #41
0
 def __init__(self):
     Canvas.__init__(self, 300, 300)
     self.draw()     
예제 #42
0
 def __init__(self):
     Canvas.__init__(self, 150, 150)
     self.img = CanvasImage('images/wallpaper.png', self)