Computer >> 컴퓨터 >  >> 프로그램 작성 >> Python

Tkinter에서 그리드의 정보를 업데이트하는 방법은 무엇입니까?

<시간/>

Tkinter 응용 프로그램에 Grid Geometry Manager를 사용하여 창에 배치된 위젯이 있다고 가정해 보겠습니다. Tkinter 위젯의 속성을 변경하려면 configure(**options)를 사용할 수 있습니다. 방법. 창에서 위젯을 렌더링하는 동안 위젯의 속성을 전역적으로 변경할 수 있는 액세스 권한을 부여하는 변수에 생성자를 할당해야 합니다.

예시

# Import the required libraries
from tkinter import *

# Create an instance of tkinter frame or window
win=Tk()

# Set the size of the window
win.geometry("700x350")

# Add a Label widget and assign it to a new variable
label=Label(win, text="This is Houstan Control. " "We've detected a new Mission", background="skyblue",font=('Aerial 11'))
label.grid(row=0, column=2)

win.mainloop()

출력

위의 코드를 실행하면 창의 가장 왼쪽에 레이블 위젯이 정렬된 창이 표시됩니다.

Tkinter에서 그리드의 정보를 업데이트하는 방법은 무엇입니까?