📜  在 tkinter 中定位标签的最简单方法 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:32.500000             🧑  作者: Mango

代码示例1
#The easiest way to position labels on the screen is to use the 'place' method

#Do the following

# Import tkinter
from tkinter import *

# Create a window (does not have to be a root window)
window = Tk()
window.title("Positioning Labels")
window.geometry("900x600")

# Create a label
Label(window, text = "This is a label").place(x = 80, y = 120)
"""
What we did was:
    - create a label using the 'Label()' function
    - told where the label should be placed 'window'
    - what the text of the label should be 'text'
    - told the coordinates of the label on the screen 'place(x = ---, y = ---)'
"""

# Hope this helped you. This is a very easy way to place labels on the screen
# which allows us to control the position with ease.

# By AstroBlade :)