finish switch video and DPI adjust
This commit is contained in:
parent
d397c7bbe2
commit
0ab0dd28dc
|
@ -26,7 +26,7 @@ exe = EXE(
|
||||||
bootloader_ignore_signals=False,
|
bootloader_ignore_signals=False,
|
||||||
strip=False,
|
strip=False,
|
||||||
upx=True,
|
upx=True,
|
||||||
console=True,
|
console=False,
|
||||||
disable_windowed_traceback=False,
|
disable_windowed_traceback=False,
|
||||||
argv_emulation=False,
|
argv_emulation=False,
|
||||||
target_arch=None,
|
target_arch=None,
|
||||||
|
|
43
src/main.py
43
src/main.py
|
@ -11,7 +11,7 @@ import functools
|
||||||
|
|
||||||
class App(ctk.CTk):
|
class App(ctk.CTk):
|
||||||
__window_width = 1280
|
__window_width = 1280
|
||||||
__window_height = 1350
|
__window_height = 1450
|
||||||
__column_weight = [1, 9, 3]
|
__column_weight = [1, 9, 3]
|
||||||
serial_status = False
|
serial_status = False
|
||||||
serial_baudrate = 9600
|
serial_baudrate = 9600
|
||||||
|
@ -41,7 +41,8 @@ class App(ctk.CTk):
|
||||||
ctk.set_widget_scaling(2.0)
|
ctk.set_widget_scaling(2.0)
|
||||||
messagebox.isHighDIP = True
|
messagebox.isHighDIP = True
|
||||||
else:
|
else:
|
||||||
ctk.set_window_scaling(0.8)
|
ctk.set_window_scaling(0.5)
|
||||||
|
ctk.set_widget_scaling(0.8)
|
||||||
|
|
||||||
# find the center point
|
# find the center point
|
||||||
center_x = int(screen_width / 2 - width / 2)
|
center_x = int(screen_width / 2 - width / 2)
|
||||||
|
@ -235,6 +236,27 @@ class App(ctk.CTk):
|
||||||
)
|
)
|
||||||
gain_button[i].grid(column=1, row=i, sticky=ctk.NSEW, pady=10, padx=20)
|
gain_button[i].grid(column=1, row=i, sticky=ctk.NSEW, pady=10, padx=20)
|
||||||
|
|
||||||
|
button_frame = ctk.CTkFrame(data_frame)
|
||||||
|
button_frame.grid(
|
||||||
|
column=0, columnspan=2, row=5, sticky=ctk.NSEW, pady=10, padx=10, ipady=20
|
||||||
|
)
|
||||||
|
button_frame.columnconfigure(0, weight=1)
|
||||||
|
button_frame.columnconfigure(1, weight=1)
|
||||||
|
switch_day = ctk.CTkButton(
|
||||||
|
button_frame,
|
||||||
|
text="切换为白天",
|
||||||
|
font=self.font,
|
||||||
|
command=functools.partial(self.setvideo, 0),
|
||||||
|
)
|
||||||
|
switch_day.grid(column=0, row=0, sticky=ctk.NSEW, padx=10, ipady=20)
|
||||||
|
switch_night = ctk.CTkButton(
|
||||||
|
button_frame,
|
||||||
|
text="切换为黑夜",
|
||||||
|
font=self.font,
|
||||||
|
command=functools.partial(self.setvideo, 1),
|
||||||
|
)
|
||||||
|
switch_night.grid(column=1, row=0, sticky=ctk.NSEW, padx=10, ipady=20)
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def updateSerial(self, event: Optional[Any] = None):
|
def updateSerial(self, event: Optional[Any] = None):
|
||||||
|
@ -330,6 +352,23 @@ class App(ctk.CTk):
|
||||||
print("Please Connect to Serial")
|
print("Please Connect to Serial")
|
||||||
messagebox.showError("Please Connect Serial Port")
|
messagebox.showError("Please Connect Serial Port")
|
||||||
|
|
||||||
|
def setvideo(self, video: int) -> None:
|
||||||
|
try:
|
||||||
|
is_open = self.serial.is_open()
|
||||||
|
except AttributeError:
|
||||||
|
messagebox.showError("Please Connect to Serial")
|
||||||
|
else:
|
||||||
|
if is_open:
|
||||||
|
if video == 0:
|
||||||
|
self.serial.write("cmdd".encode())
|
||||||
|
elif video == 1:
|
||||||
|
self.serial.write("cmdn".encode())
|
||||||
|
else:
|
||||||
|
messagebox.showError("Set Video Error!")
|
||||||
|
else:
|
||||||
|
messagebox.showError("Please Open Serial")
|
||||||
|
return None
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.mainloop()
|
self.mainloop()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue