我有一个程序可以在带有多个标签的GUI屏幕上显示文本。但是所有标签都在新行中显示文本,我想在单行中显示文本。代码如下:
from tkinter import *
import tkinter as tk
win = Tk()
win.title("Label Screen")
win.geometry("800x600+50+50")
win.config(bg='white')
label1=Label(win, text="Label 1", font=("Calibri",24,"bold"), bg='white')
label1.pack(pady=15)
label2=Label(win, text="Label 2", font=("Calibri",24,"bold"), bg='white')
label2.pack(pady=15)
label3=Label(win, text="Label 3", font=("Calibri",24,"bold"), bg='white')
label3.pack(pady=15)
win.mainloop()
执行此操作:
label1.pack(side=tk.Left,pady=15)
label2.pack(side=tk.Left,pady=15)
label3.pack(side=tk.Left,pady=15)