main
[Python] tkinter 사용 예제 - 슬래쉬, 역슬래쉬 변경 GUI 본문
import tkinter
def Convert():
text = textExample.get("1.0","end")
if '/' in text:
text = text.replace('/', '\\')
elif '\\' in text :
text = text.replace('\\', '/')
else :
print('변경할 문자가 없습니다.')
textExample.delete(1.0,"end")
textExample.insert(1.0, text)
# 화면 생성
window = tkinter.Tk()
# 제목
window.title("Convert Slash")
# 화면 크기 설정
window.geometry('320x240')
# label
label = tkinter.Label(window, text="입력란", font=("돋음", 10))
# textbox
textExample=tkinter.Text(window, height=10)
textExample.pack()
# 버튼
btnRead=tkinter.Button(window, height=1, width=10, text="Convert", command=Convert)
btnRead.pack()
# 프로그램이 종료될 때까지 실행됨
window.mainloop()
'Python' 카테고리의 다른 글
[Django] 프로젝트 내부에 App 만들기 (0) | 2023.04.28 |
---|---|
[Django] Django 설치 및 프로젝트 생성 (Python 3.10 / Django 4.2) (0) | 2023.04.28 |
[Python] Python3 설치하기 (v 3.8.5) (0) | 2022.09.27 |
[Python] - 웹 크롤링 (selenium/beautifulsoup4 예제) (0) | 2022.09.02 |
[Python] - 웹 크롤링 Parsing/Download (beautifulsoup4 예제) (0) | 2022.09.01 |
Comments