from xkbgroup import XKeyboard
xkb = XKeyboard()
xkb.groups_count
4
xkb.group_num
1
xkb.group_num = 2
xkb.group_num
2
xkb.group_num -= 2
xkb.group_num
0
xkb.groups_names
['English (US)', 'Russian', 'Ukrainian', 'French']
xkb.group_name
'English (US)'
xkb.group_name = 'Ukrainian'
xkb.group_name
'Ukrainian'
xkb.group_num
2
xkb.groups_symbols
['us', 'ru', 'ua', 'fr']
xkb.group_symbol
'ua'
xkb.group_symbol = 'fr'
xkb.group_symbol
'fr'
xkb.groups_variants
['', '', '', '']
xkb.group_variant
''
xkb.group_num -= 3
xkb.group_variant
''
xkb.group_num
0
xkb.group_data
GroupData(num=0, name='English (US)', symbol='us', variant='')
xkb.groups_data
[GroupData(num=0, name='English (US)', symbol='us', variant=''), GroupData(num=1, name=
'Russian', symbol='ru', variant=''), GroupData(num=2, name='Ukrainian', symbol='ua', va
riant=''), GroupData(num=3, name='French', symbol='fr', variant='')]
xkb.format('{num} => {symbol}')
'0 => us'
xkb.group_num = 1
xkb.format('{num} => {symbol}')
'1 => ru'
xkb.group_num = 3
xkb.format('{num}: {symbol} - {name} "{variant}"')
'3: fr - French ""'
xkb.format('{count}')
'4'
xkb.format('{names}')
"['English (US)', 'Russian', 'Ukrainian', 'French']"
xkb.format('{names::}')
'English (US)RussianUkrainianFrench'
xkb.format('{names:: - }')
'English (US) - Russian - Ukrainian - French'
xkb.format('{symbols:: - }')
'us - ru - ua - fr'
xkb.format('{symbols:s: - }')
'us - ru - ua - fr'
xkb.format('{all_data}')
"[GroupData(num=0, name='English (US)', symbol='us', variant=''), GroupData(num=1, name
='Russian', symbol='ru', variant=''), GroupData(num=2, name='Ukrainian', symbol='ua', v
ariant=''), GroupData(num=3, name='French', symbol='fr', variant='')]"
xkb.format('{all_data:{{num}}}')
"['0', '1', '2', '3']"
xkb.format('{all_data:/* {{name}} /}')
"['/ English (US) /', '/ Russian /', '/ Ukrainian /', '/ French */']"
xkb.format('{all_data:{{symbol}}:\n}')
'us\nru\nua\nfr'
print(xkb.format('{all_data:{{symbol}}:\n}'))
us
ru
ua
fr
print(xkb.format('{all_data:{{num}}\: {{symbol}} - {{name}} - "{{variant}}":\n}'))
0: us - English (US) - ""
1: ru - Russian - ""
2: ua - Ukrainian - ""
3: fr - French - ""