| 10 | |
| 11 | class keyboard(): |
| 12 | def __init__(self, location=(None, None), font=('Arial', 16)): |
| 13 | self.font = font |
| 14 | numberRow = '1234567890' |
| 15 | topRow = 'QWERTYUIOP' |
| 16 | midRow = 'ASDFGHJKL' |
| 17 | bottomRow = 'ZXCVBNM' |
| 18 | keyboard_layout = [[sg.Button(c, key=c, size=(4, 2), font=self.font) for c in numberRow] + [ |
| 19 | sg.Button('⌫', key='back', size=(4, 2), font=self.font), |
| 20 | sg.Button('Esc', key='close', size=(4, 2), font=self.font)], |
| 21 | [sg.Text(' ' * 4)] + [sg.Button(c, key=c, size=(4, 2), font=self.font) for c in |
| 22 | topRow] + [sg.Stretch()], |
| 23 | [sg.Text(' ' * 11)] + [sg.Button(c, key=c, size=(4, 2), font=self.font) for c in |
| 24 | midRow] + [sg.Stretch()], |
| 25 | [sg.Text(' ' * 18)] + [sg.Button(c, key=c, size=(4, 2), font=self.font) for c in |
| 26 | bottomRow] + [sg.Stretch()]] |
| 27 | |
| 28 | self.window = sg.Window('keyboard', keyboard_layout, |
| 29 | grab_anywhere=True, keep_on_top=True, alpha_channel=0, |
| 30 | no_titlebar=True, element_padding=(0, 0), location=location, finalize=True) |
| 31 | self.hide() |
| 32 | |
| 33 | def _keyboardhandler(self): |
| 34 | if self.event is not None: |