如何在tkinter中固定标签和图像的大小和位置? 我已将代码上传到rapiberry pi 0中,并以确切的大小和位置显示。天数过去了,图像变得越来越大,标签也变得越来越小。有人可以帮我吗?
import tkinter
from tkinter import *
import paho.mqtt.client as mqtt
import json
from PIL import Image, ImageTk
import time
import datetime
root = tkinter.Tk()
def close_escape(event=None):
print("\n ESCAPED")
root.destroy()
root.overrideredirect(True)
root.overrideredirect(False)
#root.attributes("-fullscreen", True)
root.geometry("600x500")
root.resizable(False, False)
root.wm_attributes("-topmost", 1)
root.focus_set()
root.bind("<Escape>", close_escape)
#### header
wid=200;hei=90
logo = Image.open('logo.png')
logo = logo.resize((wid, hei), Image.ANTIALIAS)
l = ImageTk.PhotoImage(logo)
panel = tkinter.Label(root, image=l)
panel.pack(side="bottom", fill="both", expand="yes")
panel.place(x=1,y=0)
##body
wid=200;hei=200
im_temp = Image.open('user.png')
im_temp = im_temp.resize((wid, hei), Image.ANTIALIAS)
img = ImageTk.PhotoImage(im_temp)
panel = tkinter.Label(root, image=img)
panel.pack(side="bottom", fill="both", expand="yes")
panel.place(x=60,y=150)
name= Label(root, text='Name:', font='Tahoma 14')
name.place(x=290, y=165)
nID= Label(root, text='ID Number:', font='Tahoma 14')
nID.place(x=290, y=265)
usrnme = Label(root, font="Georgia 35")
usrnme['text'] = "Full Name"
usrnme.place(x=330,y=195)
idnum = Label(root, font="Tahoma 25")
idnum['text'] = "ID Number"
idnum.place(x=330,y=300)