-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreview.py
53 lines (47 loc) · 1.26 KB
/
preview.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import PySimpleGUI as sg
from functions import from_text_to_elements
def preview_card(text_front: str, text_back: str):
"""
It previews the card into a new window.
"""
elements_front = from_text_to_elements(text_front)
elements_back = from_text_to_elements(text_back)
layout = [
[sg.Text(text="Front: ")],
[
sg.Column(
elements_front,
scrollable=True,
vertical_scroll_only=True,
expand_x=True,
expand_y=True,
size=(None, 150),
justification="center",
)
],
[sg.Text(text="Back: ")],
[
sg.Column(
elements_back,
scrollable=True,
vertical_scroll_only=True,
expand_x=True,
size=(None, 150),
justification="center",
)
],
]
window = sg.Window(
"Preview Card",
size=(500, 400),
layout=layout,
keep_on_top=True,
modal=True,
finalize=True,
resizable=True,
)
while True:
event, values = window.read()
if event in (sg.WIN_CLOSED, "Exit"):
break
window.close()