-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGPT_PySimpleGUI.py
More file actions
41 lines (33 loc) · 1.36 KB
/
GPT_PySimpleGUI.py
File metadata and controls
41 lines (33 loc) · 1.36 KB
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
import PySimpleGUI as sg
def main():
# Define the layout
layout = [
[sg.Text("Title:"), sg.InputText(key="title")],
[sg.Text("Description:"), sg.InputText(key="description")],
[sg.Text("Date Format:"), sg.Radio("MM/DD/YYYY", "date_format", default=True), sg.Radio("DD/MM/YYYY", "date_format")],
[sg.Text("Singles:"), sg.Checkbox("Yes", key="singles")],
[sg.Text("Number (1-10):"), sg.Slider(range=(1, 10), orientation="h", key="number")],
[sg.Button("Submit"), sg.Button("Cancel")]
]
# Create the window
window = sg.Window("Input Form", layout)
while True:
event, values = window.read()
if event == sg.WIN_CLOSED or event == "Cancel":
break
elif event == "Submit":
title = values["title"]
description = values["description"]
date_format = "MM/DD/YYYY" if values[0] else "DD/MM/YYYY"
singles = values["singles"]
number = int(values["number"])
# You can do something with the inputs here, like printing them
print(f"Title: {title}")
print(f"Description: {description}")
print(f"Date Format: {date_format}")
print(f"Singles: {singles}")
print(f"Number: {number}")
window.close()
window.close()
if __name__ == "__main__":
main()