Python 如何在Tkinter上的标签上画一个圆?

Python 如何在Tkinter上的标签上画一个圆?,python,sockets,tkinter,label,Python,Sockets,Tkinter,Label,我试着在标签上画一个圆圈(应该是鼠标光标),标签上有图像。 每次我把圆放在插座上时,它的位置都需要改变 我注意到我的代码上有**的鼠标位置 我不知道怎么做,如果你能帮我,我会很高兴的, 非常感谢 import socket from PIL import Image import StringIO import Tkinter from PIL import Image from PIL import ImageTk import

我试着在标签上画一个圆圈(应该是鼠标光标),标签上有图像。 每次我把圆放在插座上时,它的位置都需要改变 我注意到我的代码上有**的鼠标位置 我不知道怎么做,如果你能帮我,我会很高兴的, 非常感谢

        import socket
    from PIL import Image
    import StringIO
    import Tkinter
    from PIL import Image
    from PIL import ImageTk
    import threading


    RECV_BLOCK=1024

    s=socket.socket()
    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    s.connect(("127.0.0.1",12345))


    im = None
    def ShowImage():
            root = Tkinter.Tk()
            label = Tkinter.Label(root)
            label.pack()
            img = None
            tkimg = [None]  # This, or something like it, is necessary because if you do not keep a reference to PhotoImage instances, they get garbage collected.



            delay = 2   # in milliseconds
            def loopCapture():
                print "capturing"
    #    img = fetch_image(URL,USERNAME,PASSWORD)
                global im
                while im==None:
                        continue
                img = im
                tkimg[0] = ImageTk.PhotoImage(img)
                label.config(image=tkimg[0])
                root.update_idletasks()
                root.after(delay, loopCapture)

            loopCapture()
            root.mainloop()

    def rcvimage():
            global im
            for i in range(1000):
                    data=''

                    size=s.recv(RECV_BLOCK)
                    s.send(size)
                    size=int(size)

                    while  True:
                            buf=s.recv(RECV_BLOCK)
                            data+=buf

                            if len(data)>=size:
                                    break

                    pic =data[:data.find("$$$$$$")]
                    mouse=data[data.find("$$$$$$")+6:] # **the position of the cursor is here - for example ("125$200") - the first number is x, and the second is y**
                    print mouse
                    try:

                            print(len(pic))
                            f=StringIO.StringIO(pic)
                            global im
                            im=Image.open(f)
                            #ShowImage(im)
                            #im.show()
                            s.send ("next")
                    except Exception as e:
                            s.send("fail:"+e.message)
                            break

            print "End"
    thread2 = threading.Thread(target = rcvimage)
    thread1 = threading.Thread(target = ShowImage)

    thread1.start()
    thread2.start()

不能在已具有图像的标签上绘制图像。您可以使用
configure
方法更改光标本身


但是,如果使用非常小的画布而不是标签,则可以在添加到画布的文本顶部绘制。

什么是配置方法?我怎样才能用它画老鼠?我需要建立一个东西,每次他得到鼠标的位置时都会画出鼠标,它需要成为屏幕共享项目的一部分