Lecture 윈도 프로그램

Views 127 • Comments 0 • Last Updated at 6 months ago Full screen  
  • 윈도우 프로그램
  • 윈도우 프로그램

기본 구조

# tkinter_base_01.py
from tkinter import *  #1

win = Tk()   #2

win.mainloop()   #3
  1. tkinter라이브러리를 호출한다.
  2. win 이라는 이름의 윈도우를 만든다.
  3. win이 무한 루프로 실행된다. 이벤트가 일어나는지 확인하고 있다가 이벤트가 발생하면 해당 이벤트에 해당하는 작업을 진행한다.

윈도우 크기 조절

# tkinter_base_02.py
from tkinter import *
win = Tk()
win.title('첫번째 연습')   #1
win.geometry('400x100')   #2
win.resizable(width = False, height = False)   #3
win.mainloop()
  1. 창의 제목을 지정한다.
  2. 창의 크기를 정한다.
  3. 창의 크기 변경을 지정한다. width와 height이 거짓이므로 넓이와 높이 모두 변경이 안된다. width와 height이 참이면 창의 크기가 변경된다.
first article
next article
Comments
Feel free to ask a question, answer or comment, etc.