【发布时间】:2016-04-11 00:55:34
【问题描述】:
我正在尝试将我的笔记本电脑屏幕投影到 52 英寸电视中。我需要背景图像来填满整个屏幕(与我正在投影的电视的尺寸无关)。投影时窗口可以调整大小,但图像没有。我错过了什么?
我正在使用 python 和 tkinter
from Tkinter import *
root = Tk()
photo = PhotoImage(file= r"a.gif")
w = Label(root, text="Hello, world!")
root.overrideredirect(True)
root.geometry("{0}x{1}+0+0".format(root.winfo_screenwidth(), root.winfo_screenheight()))
root.focus_set() # <-- move focus to this widget
root.bind("<Escape>", lambda e: e.widget.quit())
canvas = Canvas(root) #, width=root.winfo_screenwidth(), height=root.winfo_screenheight())
canvas.pack(side='top', fill='both', expand='True')
canvas.create_image(0, 0, image=photo, anchor='nw')
w.pack()
root.mainloop()
【问题讨论】: