Skip to content

Commit e55d0ba

Browse files
committed
control.py: Add support for custom text and more font chars
Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent 762cb83 commit e55d0ba

File tree

1 file changed

+154
-20
lines changed

1 file changed

+154
-20
lines changed

control.py

Lines changed: 154 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,9 @@ def gui():
10401040
sg.Button("Stop", k='-STOP-TIME-')
10411041
],
10421042

1043+
[sg.Text("Custom Text")],
1044+
[sg.Input(k='-CUSTOM-TEXT-', s=7), sg.Button("Show", k='SEND-CUSTOM-TEXT')],
1045+
10431046
[sg.Text("Display Text with Symbols")],
10441047
[sg.Button("Send '2 5 degC thunder'", k='-SEND-TEXT-')],
10451048

@@ -1109,6 +1112,9 @@ def gui():
11091112
if event == '-SEND-TEXT-':
11101113
show_symbols(['2', '5', 'degC', ' ', 'thunder'])
11111114

1115+
if event == 'SEND-CUSTOM-TEXT':
1116+
show_string(values['-CUSTOM-TEXT-'].upper())
1117+
11121118
if event == '-PLAY-SNAKE-':
11131119
snake()
11141120

@@ -1582,29 +1588,29 @@ def convert_font(num):
15821588
1, 0, 0, 0, 1,
15831589
1, 0, 0, 0, 1,
15841590
],
1585-
'D': [
1591+
'B': [
15861592
1, 1, 1, 1, 0,
15871593
1, 0, 0, 0, 1,
1588-
1, 0, 0, 0, 1,
1594+
1, 1, 1, 1, 0,
15891595
1, 0, 0, 0, 1,
15901596
1, 0, 0, 0, 1,
15911597
1, 1, 1, 1, 0,
15921598
],
1593-
'O': [
1594-
0, 1, 1, 1, 0,
1595-
1, 0, 0, 0, 1,
1596-
1, 0, 0, 0, 1,
1599+
'C': [
1600+
1, 1, 1, 1, 1,
1601+
1, 0, 0, 0, 0,
1602+
1, 0, 0, 0, 0,
1603+
1, 0, 0, 0, 0,
1604+
1, 0, 0, 0, 0,
1605+
1, 1, 1, 1, 1,
1606+
],
1607+
'D': [
1608+
1, 1, 1, 1, 0,
15971609
1, 0, 0, 0, 1,
15981610
1, 0, 0, 0, 1,
1599-
0, 1, 1, 1, 0,
1600-
],
1601-
'V': [
16021611
1, 0, 0, 0, 1,
16031612
1, 0, 0, 0, 1,
1604-
0, 1, 0, 1, 1,
1605-
0, 1, 0, 1, 1,
1606-
0, 0, 1, 0, 0,
1607-
0, 0, 1, 0, 0,
1613+
1, 1, 1, 1, 0,
16081614
],
16091615
'E': [
16101616
1, 1, 1, 1, 1,
@@ -1614,13 +1620,13 @@ def convert_font(num):
16141620
1, 0, 0, 0, 0,
16151621
1, 1, 1, 1, 1,
16161622
],
1617-
'R': [
1618-
1, 1, 1, 1, 0,
1619-
1, 0, 0, 1, 0,
1620-
1, 1, 1, 1, 0,
1621-
1, 1, 0, 0, 0,
1622-
1, 0, 1, 0, 0,
1623-
1, 0, 0, 1, 0,
1623+
'F': [
1624+
1, 1, 1, 1, 1,
1625+
1, 0, 0, 0, 0,
1626+
1, 1, 1, 1, 1,
1627+
1, 0, 0, 0, 0,
1628+
1, 0, 0, 0, 0,
1629+
1, 0, 0, 0, 0,
16241630
],
16251631
'G': [
16261632
0, 1, 1, 1, 0,
@@ -1630,6 +1636,46 @@ def convert_font(num):
16301636
1, 0, 0, 0, 1,
16311637
0, 1, 1, 1, 0,
16321638
],
1639+
'H': [
1640+
1, 0, 0, 0, 1,
1641+
1, 0, 0, 0, 1,
1642+
1, 1, 1, 1, 1,
1643+
1, 0, 0, 0, 1,
1644+
1, 0, 0, 0, 1,
1645+
1, 0, 0, 0, 1,
1646+
],
1647+
'I': [
1648+
0, 1, 1, 1, 0,
1649+
0, 0, 1, 0, 0,
1650+
0, 0, 1, 0, 0,
1651+
0, 0, 1, 0, 0,
1652+
0, 0, 1, 0, 0,
1653+
0, 1, 1, 1, 0,
1654+
],
1655+
'J': [
1656+
0, 1, 1, 1, 1,
1657+
0, 0, 0, 0, 1,
1658+
0, 0, 0, 0, 1,
1659+
0, 0, 0, 0, 1,
1660+
0, 1, 0, 0, 1,
1661+
0, 0, 1, 1, 0,
1662+
],
1663+
'K': [
1664+
1, 0, 0, 1, 0,
1665+
1, 0, 1, 0, 0,
1666+
1, 1, 0, 0, 0,
1667+
1, 0, 1, 0, 0,
1668+
1, 0, 0, 1, 0,
1669+
1, 0, 0, 0, 1,
1670+
],
1671+
'L': [
1672+
1, 0, 0, 0, 0,
1673+
1, 0, 0, 0, 0,
1674+
1, 0, 0, 0, 0,
1675+
1, 0, 0, 0, 0,
1676+
1, 0, 0, 0, 0,
1677+
1, 1, 1, 1, 1,
1678+
],
16331679
'M': [
16341680
0, 0, 0, 0, 0,
16351681
0, 1, 0, 1, 0,
@@ -1638,6 +1684,22 @@ def convert_font(num):
16381684
1, 0, 1, 0, 1,
16391685
1, 0, 1, 0, 1,
16401686
],
1687+
'N': [
1688+
1, 0, 0, 0, 1,
1689+
1, 1, 0, 0, 1,
1690+
1, 0, 1, 0, 1,
1691+
1, 0, 1, 0, 1,
1692+
1, 0, 1, 0, 1,
1693+
1, 0, 0, 1, 1,
1694+
],
1695+
'O': [
1696+
0, 1, 1, 1, 0,
1697+
1, 0, 0, 0, 1,
1698+
1, 0, 0, 0, 1,
1699+
1, 0, 0, 0, 1,
1700+
1, 0, 0, 0, 1,
1701+
0, 1, 1, 1, 0,
1702+
],
16411703
'P': [
16421704
1, 1, 1, 0, 0,
16431705
1, 0, 0, 1, 0,
@@ -1646,6 +1708,78 @@ def convert_font(num):
16461708
1, 0, 0, 0, 0,
16471709
1, 0, 0, 0, 0,
16481710
],
1711+
'Q': [
1712+
0, 1, 1, 1, 0,
1713+
1, 0, 0, 0, 1,
1714+
1, 0, 0, 0, 1,
1715+
1, 0, 1, 0, 1,
1716+
1, 0, 0, 1, 0,
1717+
0, 1, 1, 0, 1,
1718+
],
1719+
'R': [
1720+
1, 1, 1, 1, 0,
1721+
1, 0, 0, 1, 0,
1722+
1, 1, 1, 1, 0,
1723+
1, 1, 0, 0, 0,
1724+
1, 0, 1, 0, 0,
1725+
1, 0, 0, 1, 0,
1726+
],
1727+
'S': [
1728+
1, 1, 1, 1, 1,
1729+
1, 0, 0, 0, 0,
1730+
0, 1, 1, 1, 0,
1731+
0, 0, 0, 0, 1,
1732+
0, 0, 0, 0, 1,
1733+
1, 1, 1, 1, 0,
1734+
],
1735+
'T': [
1736+
1, 1, 1, 1, 1,
1737+
0, 0, 1, 0, 0,
1738+
0, 0, 1, 0, 0,
1739+
0, 0, 1, 0, 0,
1740+
0, 0, 1, 0, 0,
1741+
0, 0, 1, 0, 0,
1742+
],
1743+
'U': [
1744+
1, 0, 0, 0, 1,
1745+
1, 0, 0, 0, 1,
1746+
1, 0, 0, 0, 1,
1747+
1, 0, 0, 0, 1,
1748+
1, 0, 0, 0, 1,
1749+
1, 1, 1, 1, 1,
1750+
],
1751+
'V': [
1752+
1, 0, 0, 0, 1,
1753+
1, 0, 0, 0, 1,
1754+
0, 1, 0, 1, 1,
1755+
0, 1, 0, 1, 1,
1756+
0, 0, 1, 0, 0,
1757+
0, 0, 1, 0, 0,
1758+
],
1759+
'W': [
1760+
1, 0, 0, 0, 1,
1761+
1, 0, 0, 0, 1,
1762+
1, 0, 1, 0, 1,
1763+
1, 0, 1, 0, 1,
1764+
0, 1, 0, 1, 0,
1765+
0, 1, 0, 1, 0,
1766+
],
1767+
'Y': [
1768+
1, 0, 0, 0, 1,
1769+
1, 0, 0, 0, 1,
1770+
0, 1, 0, 1, 0,
1771+
0, 1, 0, 1, 0,
1772+
0, 0, 1, 0, 0,
1773+
0, 0, 1, 0, 0,
1774+
],
1775+
'Z': [
1776+
1, 1, 1, 1, 1,
1777+
0, 0, 0, 1, 0,
1778+
0, 0, 1, 0, 0,
1779+
0, 1, 0, 0, 0,
1780+
1, 0, 0, 0, 0,
1781+
1, 1, 1, 1, 1,
1782+
],
16491783
}
16501784
if num in font:
16511785
return font[num]

0 commit comments

Comments
 (0)