PYTHON/tkinter
-
def maintain_aspect_ratio(width, height, target_width): ratio = target_width / width new_height = int(height * ratio) return target_width, new_heightdef start_process(): if listbox_list.size()
tkinter - 사진 병합 프로그램 (8) - 프로그램 시작 및 종료def maintain_aspect_ratio(width, height, target_width): ratio = target_width / width new_height = int(height * ratio) return target_width, new_heightdef start_process(): if listbox_list.size()
2025.02.06 -
def start_process(): # 진행 상황 초기화 progressbar["value"] = 0 window.update() for i in range(listbox_list.size()): with Image.open(listbox_list.get(i)) as img: if target_width: width, height = images_info[i] img = img.resize((width, height), Image.Resampling.LANCZOS) merged_image.paste(img, (0, y_offset)) ..
tkinter - 사진 병합 프로그램 (7) - 진행율 표시(프로그레스바)def start_process(): # 진행 상황 초기화 progressbar["value"] = 0 window.update() for i in range(listbox_list.size()): with Image.open(listbox_list.get(i)) as img: if target_width: width, height = images_info[i] img = img.resize((width, height), Image.Resampling.LANCZOS) merged_image.paste(img, (0, y_offset)) ..
2025.02.06 -
def maintain_aspect_ratio(width, height, target_width): ratio = target_width / width new_height = int(height * ratio) return target_width, new_height def start_process(): # 가장 큰 사진에 맞춰 리사이즈하면 화질이 떨어지기 때문에 가장 작은 사진을 기준으로 한다. # 이는 원본 유지를 선택했을 때 한정으로 # 다른 넓이를 선택했을 땐 선택한 값에 맞추어 리사이즈한다. if listbox_list.size()
tkinter - 사진 병합 프로그램 (6) - 사진 리사이즈def maintain_aspect_ratio(width, height, target_width): ratio = target_width / width new_height = int(height * ratio) return target_width, new_height def start_process(): # 가장 큰 사진에 맞춰 리사이즈하면 화질이 떨어지기 때문에 가장 작은 사진을 기준으로 한다. # 이는 원본 유지를 선택했을 때 한정으로 # 다른 넓이를 선택했을 땐 선택한 값에 맞추어 리사이즈한다. if listbox_list.size()
2025.02.06 -
def find_path(): entry_path.delete(0, END) folder_path = filedialog.askdirectory(title="폴더 선택") if folder_path: entry_path.insert(0, folder_path)# 저장 경로 프레임frame_path = LabelFrame(window, text="저장 경로")frame_path.pack(fill="x", padx=5, pady=10)entry_path = Entry(frame_path)entry_path.pack(fill="x", side="left", padx=5, pady=10, expand=True)btn_find = Button(frame_path, text="찾기",..
tkinter - 사진 병합 프로그램 (5) - 저장 경로 지정def find_path(): entry_path.delete(0, END) folder_path = filedialog.askdirectory(title="폴더 선택") if folder_path: entry_path.insert(0, folder_path)# 저장 경로 프레임frame_path = LabelFrame(window, text="저장 경로")frame_path.pack(fill="x", padx=5, pady=10)entry_path = Entry(frame_path)entry_path.pack(fill="x", side="left", padx=5, pady=10, expand=True)btn_find = Button(frame_path, text="찾기",..
2025.02.06 -
# 리스트 박스 프레임frame_list = Frame(window)frame_list.pack(fill="x", padx=5, pady=5)scrollbar = Scrollbar(frame_list)scrollbar.pack(side="right", fill="y")#selectmode: browse(단일 선택, 방향키 이동 시 선택), single(단일 선택), multiple(다중 선택), extended(다중 선택, 마우스 드래그로 선택)listbox_list = Listbox(frame_list, selectmode="extended", height=15, yscrollcommand=scrollbar.set)listbox_list.pack(fill="both")
tkinter - 사진 병합 프로그램 (4) - 리스트 박스와 스크롤바# 리스트 박스 프레임frame_list = Frame(window)frame_list.pack(fill="x", padx=5, pady=5)scrollbar = Scrollbar(frame_list)scrollbar.pack(side="right", fill="y")#selectmode: browse(단일 선택, 방향키 이동 시 선택), single(단일 선택), multiple(다중 선택), extended(다중 선택, 마우스 드래그로 선택)listbox_list = Listbox(frame_list, selectmode="extended", height=15, yscrollcommand=scrollbar.set)listbox_list.pack(fill="both")
2025.02.06 -
def add_file(): # 파일 선택 창을 연 다음 -> 파일 선택 -> 파일 객체를 가져온다 -> 리스트 박스에 파일 객체 표시 file = filedialog.askopenfilename(title="파일 선택", filetypes=(("png files", "*.png"), ('all files', '*.*'))) # print("파일 출력: " + file) # C:/Users/ghryu/Desktop/file/장운영시간.png # print("파일 유형: " + str(type(file))) # # name_file = os.path.split(file) # print("파일명: "+ str(name_file)) # ('C:/Users/ghryu/Deskt..
tkinter - 사진 병합 프로그램 (3) - 파일 추가 및 삭제def add_file(): # 파일 선택 창을 연 다음 -> 파일 선택 -> 파일 객체를 가져온다 -> 리스트 박스에 파일 객체 표시 file = filedialog.askopenfilename(title="파일 선택", filetypes=(("png files", "*.png"), ('all files', '*.*'))) # print("파일 출력: " + file) # C:/Users/ghryu/Desktop/file/장운영시간.png # print("파일 유형: " + str(type(file))) # # name_file = os.path.split(file) # print("파일명: "+ str(name_file)) # ('C:/Users/ghryu/Deskt..
2025.02.06