Ejemplo n.º 1
0
    def __init__(self, img_url):
        GWTCanvas.__init__(self, 300, 300, 300, 300)
        loadImages([img_url], self)
        self.width = 150
        self.height = 150

        self.isActive = True
        self.onTimer()
Ejemplo n.º 2
0
 def __init__(self, img_url):
     GWTCanvas.__init__(self, 300, 300, 300, 300)
     loadImages([img_url], self)
     self.width = 150
     self.height = 150
     
     self.isActive = True
     self.onTimer()
Ejemplo n.º 3
0
 def __init__(self):
     GWTCanvas.__init__(self, 300, 300, 300, 300)
     loadImages(
         [
             'images/sun.png',
             'images/moon.png',
             'images/earth.png',
         ],
         self,
     )
     
     self.isActive = True
     self.onTimer()
Ejemplo n.º 4
0
    def __init__(self):
        GWTCanvas.__init__(self, 300, 300, 300, 300)
        loadImages(
            [
                'images/sun.png',
                'images/moon.png',
                'images/earth.png',
            ],
            self,
        )

        self.isActive = True
        self.onTimer()
Ejemplo n.º 5
0
Archivo: Space.py Proyecto: Afey/pyjs
    def __init__(self, w, h):
        GWTCanvas.__init__(self, w, h)
        self.width = w
        self.height = h
        
        self.model = Model(w, h)
        self.controller = Controller(self.model)

        images = ['./images/ship1.png',
                  './images/ship2.png',
                  './images/asteroid.png']
        loadImages(images, self)

        self.sinkEvents(Event.KEYEVENTS)
Ejemplo n.º 6
0
    def __init__(self, w, h):
        GWTCanvas.__init__(self, w, h)
        self.width = w
        self.height = h

        self.model = Model(w, h)
        self.controller = Controller(self.model)

        images = [
            './images/ship1.png', './images/ship2.png', './images/asteroid.png'
        ]
        loadImages(images, self)

        self.sinkEvents(Event.KEYEVENTS)
Ejemplo n.º 7
0
    def __init__(self, w, h):
        GWTCanvas.__init__(self, w, h)

        self.width = w
        self.height = h
        self.key_up = self.key_down = self.key_left = self.key_right = self.key_fire = False        

        images = ['./images/Ship1.png', './images/Ship2.png', './images/Asteroid.png']
        loadImages(images, self)
        self.run = False
        #self.ship = CanvasImage('images/Ship1.png')
        #self.ship_thrust = CanvasImage('images/Ship2.png')
        #self.asteroid = CanvasImage('images/Asteroid.png')
        #self.loader = ImageLoadListener()
        #self.loader.add(self.ship)
        #self.loader.add(self.ship_thrust)
        #self.loader.add(self.asteroid)

        self.num_asteroids = NUM_ASTEROIDS

        self.sinkEvents(Event.KEYEVENTS) 
        self.onTimer()
Ejemplo n.º 8
0
    def __init__(self, width, height, gametype):
        """Initialize the GameCanvas and construct the layout

        :param width:  width of the game canvas in pixels
        :type width:  int
        :param height:  height of the game canvas in pixels
        :type height:  int
        :param gametype:  type of game to be loaded
        :type gametype:  str
        """
        DockPanel.__init__(self,HorizontalAlignment=HasAlignment.ALIGN_CENTER,Spacing=10)
        
        if gametype == 'Chess':
            self.game = Chess()
            self.boardtype = self.game.boardtype
            self.images = []
            for i in self.game.pieces:
                self.images.append('./images/Chess/'+str(i.player)+str(i.name)+'.svg')
            self.images = list(set(self.images))  #eliminate duplicates
            
        self.GC = GameCanvas(width, height, self.game)
        loadImages(self.images, self)
        self.GC.addMouseListener(self)
        
        self.b = Button("Make Move", self, StyleName='teststyle')
        self.cell1 = TextBox(StyleName='boxStyle')
        self.cell2 = TextBox(StyleName='boxStyle')

        self.cellPanel = HorizontalPanel(VerticalAlignment=HasAlignment.ALIGN_MIDDLE)
        self.cellPanel.add(self.cell1)
        self.cellPanel.add(self.cell2)

        self.mover = VerticalPanel(HorizontalAlignment=HasAlignment.ALIGN_CENTER)
        self.mover.add(self.cellPanel)
        self.mover.add(self.b)
    
        self.add(self.GC, DockPanel.CENTER)
        self.add(self.mover, DockPanel.EAST)
Ejemplo n.º 9
0
    def drawDemo(self):
        # The following is the same as doing
        self.canvas.resize(self.width, self.height)
        #self.canvas.setCoordSize(self.width, self.height)
        #self.canvas.setPixelHeight(self.height)
        #self.canvas.setPixelWidth(self.width)

        imageUrls = ["./pyjamas.128x128.png"]

        if self.img is None:
            # The first time this demo gets run we need to load our images.
            # Maintain a reference to the image we load so we can use it
            # the next time the demo is selected
            loadImages(imageUrls, self)

        else:
            # Go ahead and animate
            if self.isImageLoaded(self.img):
                self.run = True
                #log.writebr("already loaded")
                Timer(1, self)
            else:
                Window.alert("Refresh the page to reload the image.")
Ejemplo n.º 10
0
    def __init__(self, w, h):
        GWTCanvas.__init__(self, w, h)

        self.width = w
        self.height = h
        self.key_up = self.key_down = self.key_left = self.key_right = self.key_fire = False

        images = [
            './images/Ship1.png', './images/Ship2.png', './images/Asteroid.png'
        ]
        loadImages(images, self)
        self.run = False
        #self.ship = CanvasImage('images/Ship1.png')
        #self.ship_thrust = CanvasImage('images/Ship2.png')
        #self.asteroid = CanvasImage('images/Asteroid.png')
        #self.loader = ImageLoadListener()
        #self.loader.add(self.ship)
        #self.loader.add(self.ship_thrust)
        #self.loader.add(self.asteroid)

        self.num_asteroids = NUM_ASTEROIDS

        self.sinkEvents(Event.KEYEVENTS)
        self.onTimer()
Ejemplo n.º 11
0
    def drawDemo(self):
        # The following is the same as doing
        self.canvas.resize(self.width,self.height)
        #self.canvas.setCoordSize(self.width, self.height)
        #self.canvas.setPixelHeight(self.height)
        #self.canvas.setPixelWidth(self.width)

        imageUrls = ["./pyjamas.128x128.png"]


        if self.img is None:
            # The first time this demo gets run we need to load our images.
            # Maintain a reference to the image we load so we can use it
            # the next time the demo is selected
            loadImages(imageUrls, self)

        else:
            # Go ahead and animate
            if self.isImageLoaded(self.img):
                self.run = True
                #log.debug("already loaded")
                Timer(1, self)
            else:
                Window.alert("Refresh the page to reload the image.")
Ejemplo n.º 12
0
 def __init__(self):
     GWTCanvas.__init__(self, 150, 150, 150, 150)
     loadImages(['images/wallpaper.png'], self)
Ejemplo n.º 13
0
 def __init__(self):
     GWTCanvas.__init__(self, 150, 150, 150, 150)
     loadImages(['images/wallpaper.png'], self)