Example #1
0
def test():
    '''
    there is a way to resize the console buffer...
    now, it's still in test stage to understand the winapi's work
    '''
    hstdout = Kernel32.GetStdHandle(DWORD(-11))
    if (hstdout == HANDLE(-1)):
        print('create buffer failed')

    width = 1024
    height = 690
    # resizeConsoleWindow(hstdout, width, height)

    backBuffer = consoleBackBuffer(180, 80)

    userpanel = usermenu(56, 0, 15, 17)
    userpanel.title = 'user list'
    userpanel.addContent('heyhey')
    userpanel.addContent('haha')
    userpanel.update()
    userpanel.display(backBuffer.getHandle())

    chatroom = msgroom(0, 0, 55, 17)
    chatroom.title = 'chat room'
    chatroom.addContent("eric: I'm so happy")
    chatroom.update()
    chatroom.display(backBuffer.getHandle())

    inLabel = inputLabel(0, 18, 71, 3)
    inLabel.update()
    inLabel.display(backBuffer.getHandle())

    backBuffer.present(hstdout)
    input()
Example #2
0
 def __init__(self, sx, sy, w, h):
     self.console = consoleBackBuffer(w, h)
     self.console.setWriteSrc(sx, sy)
     self.gx = sx
     self.gy = sy
     #global position
     self.w = w
     self.h = h
     self.mTitle = 'no name'
     self.content = []