class Console(Window): def __init__(self): Window.__init__(self, 0, 0, getDesktop().width, \ getDesktop().height/4, topmost = 1) self.setLayout(pyui.layouts.BorderLayoutManager()) self.outputBox = LineDisplay() self.addChild(self.outputBox, pyui.locals.CENTER) self.pack() Events.addCallbacks('keyDown', self.keyDown) self.oldout = sys.stdout sys.stdout = self def write(self, text): self.outputBox.addLine(text) self.oldout.write(text) def keyDown(self, event): if(event.key < 256 and chr(event.key) == '`'): if(self.show == 1): hideConsole() else: showConsole() return 1 return 0
class Console(Window): def __init__(self): Window.__init__(self, 0, 0, getDesktop().width, \ getDesktop().height/4, topmost = 1) self.setLayout(pyui.layouts.BorderLayoutManager()) self.outputBox = LineDisplay() self.addChild(self.outputBox, pyui.locals.CENTER) self.pack() Events.addCallbacks('keyDown', self.keyDown) self.oldout = sys.stdout sys.stdout = self def write(self, text): self.outputBox.addLine(text) self.oldout.write(text) def keyDown(self, event): if (event.key < 256 and chr(event.key) == '`'): if (self.show == 1): hideConsole() else: showConsole() return 1 return 0
def __init__(self, x = -1, y = -1, w = 300, h = 200, title = None): Dialog.__init__(self, x, y, w, h, title) self.setLayout(pyui.layouts.BorderLayoutManager()) self.lines = LineDisplay() self.addChild(self.lines, pyui.locals.CENTER) self.pack() self.oldout = sys.stdout self.oldin = sys.stdin
def __init__(self): Window.__init__(self, 0, 0, getDesktop().width, \ getDesktop().height/4, topmost = 1) self.setLayout(pyui.layouts.BorderLayoutManager()) self.outputBox = LineDisplay() self.addChild(self.outputBox, pyui.locals.CENTER) self.pack() Events.addCallbacks('keyDown', self.keyDown) self.oldout = sys.stdout sys.stdout = self
class MultiLineDialog(Dialog): def __init__(self, x = -1, y = -1, w = 300, h = 200, title = None): Dialog.__init__(self, x, y, w, h, title) self.setLayout(pyui.layouts.BorderLayoutManager()) self.lines = LineDisplay() self.addChild(self.lines, pyui.locals.CENTER) self.pack() self.oldout = sys.stdout self.oldin = sys.stdin def addLine(self, text): self.lines.addLine(text)