-
Notifications
You must be signed in to change notification settings - Fork 0
/
gui3.py
145 lines (124 loc) · 3.43 KB
/
gui3.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
from pathlib import Path
from pathlib import Path
import subprocess
from tkinter import *
from tkinter import Tk, Canvas, Entry, Text, Button, PhotoImage
from tkinter import Tk, Canvas, Entry, Text, Button, PhotoImage, messagebox
from PIL import Image, ImageTk
OUTPUT_PATH = Path(__file__).parent
ASSETS_PATH = OUTPUT_PATH / Path(r"assets3/frame0")
def center_window(window,height=600,width=500):
window.update_idletasks()
screen_width = window.winfo_screenwidth()
screen_height = window.winfo_screenheight()
x = (screen_width - width) // 2
y = (screen_height - height) // 2
window.geometry(f"{width}x{height}+{x}+{y}")
def relative_to_assets(path: str) -> Path:
return ASSETS_PATH / Path(path)
window = Tk()
center_window(window)
window.wm_iconname("Image your disk")
window.title("IYD Imaging Process")
im = Image.open('assets0/favicon.ico')
photo = ImageTk.PhotoImage(im)
window.wm_iconphoto(True, photo)
window.wm_iconname("IYD")
window.geometry("600x500")
window.configure(bg = "#545252")
canvas = Canvas(
window,
bg = "#545252",
height = 500,
width = 600,
bd = 0,
highlightthickness = 0,
relief = "ridge"
)
canvas.place(x = 0, y = 0)
image_image_1 = PhotoImage(
file=relative_to_assets("image_1.png"))
image_1 = canvas.create_image(
124.0,
455.0,
image=image_image_1
)
button_image_1 = PhotoImage(
file=relative_to_assets("button_1.png"))
button_1 = Button(
image=button_image_1,
borderwidth=0,
highlightthickness=0,
relief="flat"
)
button_1.place(
x=0.0,
y=0.0,
width=271.0,
height=500.0
)
selected_format = StringVar()
def on_checkbox_click():
if raw_var.get() == 1 and dd_var.get() == 0:
selected_format.set("RAW")
elif dd_var.get() == 1 and raw_var.get() == 0:
selected_format.set("DD")
else:
messagebox.showwarning("Warning", "Please Select 1 Option!")
# print(f"Selected format: {selected_format.get()}")
# Variables for checkbuttons
raw_var = IntVar()
dd_var = IntVar()
checkbutton_raw = Checkbutton(
window,
text="RAW",
variable=raw_var,
onvalue=1,
offvalue=0,
width=8,
command=on_checkbox_click,
bg="#D9D9D9",
font=("Arial", 12),
relief="raised",
padx=10,
pady=5,
)
checkbutton_raw.place(x=377, y=189)
checkbutton_dd = Checkbutton(
window,
text="DD",
variable=dd_var,
onvalue=1,
width=8,
offvalue=0,
command=on_checkbox_click,
bg="#D9D9D9",
font=("Arial", 12),
relief="raised",
padx=10,
pady=5,
)
checkbutton_dd.place(x=377, y=83)
def on_next_click():
if dd_var.get() == 0 and raw_var.get() == 0:
messagebox.showwarning("Warning", "Please Select 1 Option!")
elif dd_var.get() == 1 and raw_var.get() == 1:
messagebox.showwarning("Warning", "Please Select Only 1 Option!")
else:
window.destroy()
import sys
# sys.path.append("build")
import gui4
def on_back_click():
window.destroy()
import sys
# sys.path.append("build")
# import gui2
# subprocess.run(["python3", "gui2.py"])
subprocess.run(["sudo", "myenv/bin/python3", "gui2.py"])
next_button = Button(window, text="Next", command=on_next_click, width=10, bg="#333333", fg="white")
next_button.place(x=452, y=389)
back_button = Button(window, text="Back", command=on_back_click, width=10, bg="#333333", fg="white")
back_button.place(x=312, y=389)
window.resizable(False, False)
window.mainloop()