Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/315.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 将tkinter小部件放置在前景中_Python_User Interface_Tkinter - Fatal编程技术网

Python 将tkinter小部件放置在前景中

Python 将tkinter小部件放置在前景中,python,user-interface,tkinter,Python,User Interface,Tkinter,我无法创建一个文本框(使用tkinter的文本小部件),该文本框位于背景中,上面有一个画布项目(例如椭圆形)(foregroud): 即使我使用c.tag\u lower(t),c.tag\u raise(o),它也不起作用。你知道如何解决这个问题吗?这是记录在案的行为。不能在画布中嵌入的其他小部件上绘制。没有解决办法。要能够在文本顶部绘制,您唯一的选择是使用create\u text绘制文本 多谢各位。在我的示例中,是否可以在主画布上创建一个子画布,其中包含oval?然后椭圆将覆盖在文本小部件

我无法创建一个文本框(使用
tkinter
的文本小部件),该文本框位于背景中,上面有一个画布项目(例如椭圆形)(foregroud):


即使我使用
c.tag\u lower(t)
c.tag\u raise(o)
,它也不起作用。你知道如何解决这个问题吗?

这是记录在案的行为。不能在画布中嵌入的其他小部件上绘制。没有解决办法。要能够在文本顶部绘制,您唯一的选择是使用
create\u text
绘制文本

多谢各位。在我的示例中,是否可以在主画布上创建一个子画布,其中包含
oval
?然后椭圆将覆盖在文本小部件上?不。子椭圆将隐藏文本小部件。
import Tkinter as Tk

root = Tk.Tk()
c = Tk.Canvas(root, width=400, height=400, bg='white')
o = c.create_oval(10, 10, 390, 390, fill='red')
c.grid(row=0, column=0, columnspan=2, padx=5, pady=5)
t = Tk.Text(c)
t.place(x=10,y=10)
c.tag_lower(t)
c.tag_raise(o)
root.mainloop()