def getGWindow(self):
		'''
		Returns the graphics window in which this event occurred.
		
		@rtype: GWindow
		'''
		return gwindow.GWindow(gwd)
    def parseWindowEvent(self, tokens, type):
        id = tokens[0]
        tokens = tokens[1:]

        time = float(tokens[0])
        tokens = tokens[1:]

        e = gevents.GWindowEvent(type,
                                 gwindow.GWindow(Platform.WINDOW_TABLE[id]))
        e.setEventTime(time)
        return e
    def parseKeyEvent(self, tokens, type):
        id = tokens[0]
        tokens = tokens[1:]

        time = float(tokens[0])
        tokens = tokens[1:]

        modifiers = int(tokens[0])
        tokens = tokens[1:]

        keyChar = int(tokens[0])
        tokens = tokens[1:]

        keyCode = int(tokens[0])
        tokens = tokens[1:]

        e = gevents.GKeyEvent(type, \
              gwindow.GWindow(gwd = Platform.WINDOW_TABLE[id]), \
              keyChar, \
              keyCode)
        e.setEventTime(time)
        e.setModifiers(modifiers)
        return e
    def parseMouseEvent(self, tokens, type):
        id = tokens[0]
        tokens = tokens[1:]

        time = float(tokens[0])
        tokens = tokens[1:]

        modifiers = int(tokens[0])
        tokens = tokens[1:]

        x = float(tokens[0])
        tokens = tokens[1:]

        y = float(tokens[0])
        tokens = tokens[1:]

        e = gevents.GMouseEvent(type, \
              gwindow.GWindow(gwd = Platform.WINDOW_TABLE[id]), \
              x, \
              y)
        e.setEventTime(time)
        e.setModifiers(modifiers)
        return e
Beispiel #5
0
import gwindow
import gtypes
import gobjects
import sound
import filelib

raw_input("\nPress enter to start graphics program\n")

window = gwindow.GWindow()

raw_input("\nPress enter to continue\n")

rect = gobjects.GRect(45, 54, 10, 10)
window.add(rect)

raw_input("\nPress enter to continue\n")

rect.setFilled(True)

raw_input("\nPress enter to continue\n")

rect.move(100, 100)

raw_input("\nPress enter to continue\n")

rect.setLocation(x=0, y=0)

raw_input("\nPress enter to continue\n")

rect.setColor(color="RED")