tkinter.TclError:图像“ pyimage2”不存在

时间:2019-11-20 13:38:33

标签: python-3.x tkinter tkinter-canvas

因此,我有3个窗口用于我的项目,并且我希望这3个窗口具有每个背景图像,但我不知道如何,现在已经花了很多小时才弄清楚。这是我的代码。

Started kubelet: The Kubernetes Node Agent.
kubelet.service: Current command vanished from the unit file, execution of the com
Stopping kubelet: The Kubernetes Node Agent...
Stopped kubelet: The Kubernetes Node Agent.
Started kubelet: The Kubernetes Node Agent.
F1120 04:53:12.437733    9430 server.go:196] failed to load Kubelet config file
kubelet.service: Main process exited, code=exited, status=255/n/a
kubelet.service: Failed with result 'exit-code'.
Stopped kubelet: The Kubernetes Node Agent.
Started kubelet: The Kubernetes Node Agent.
Flag --cgroup-driver has been deprecated, This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.
Flag --resolv-conf has been deprecated, This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.
Flag --cgroup-driver has been deprecated, This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.
Flag --resolv-conf has been deprecated, This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.
I1120 04:53:20.229997    9604 server.go:410] Version: v1.16.3
I1120 04:53:20.230143    9604 plugins.go:100] No cloud provider specified.
I1120 04:53:20.230154    9604 server.go:773] Client rotation is on, will bootstrap in background
F1120 04:53:20.230185    9604 server.go:271] failed to run Kubelet: unable to load bootstrap kubeconfig: stat /etc/kubernetes/bootstrap-kubelet.conf: no such file or directory
kubelet.service: Main process exited, code=exited, status=255/n/a
kubelet.service: Failed with result 'exit-code'.
kubelet.service: Service hold-off time over, scheduling restart.
kubelet.service: Scheduled restart job, restart counter is at 7.
Stopped kubelet: The Kubernetes Node Agent.
Failed while requesting a signed certificate from the master: cannot create certificate signing request: Post https://<host>:6443/apis/certificates.k8s.io/v1beta1/certificatesigningrequests:
--cgroups-per-qos enabled, but --cgroup-root was not specified.  defaulting to /
container manager verified user specified cgroup-root exists: []
Creating Container Manager object based on Node Config: {RuntimeCgroupsName: SystemCgroupsName: KubeletCgroupsName: ContainerRuntime:docker CgroupsPerQOS:true CgroupRoot:/ CgroupDriver:cgroupfs
[fake topologymanager] NewFakeManager
Creating device plugin manager: true
anager.go:39] [fake topologymanager] AddHintProvider HintProvider:  &{kubelet.sock /var/lib/kubelet/device-plugins/ map[] {0 0} <nil> {{} [0 0 0]} 0x1b6c020 0x79a0338 0x1b6ca20 map[] map[] map[] map[] map[] 0xc
[cpumanager] initializing new in-memory state store
anager.go:39] [fake topologymanager] AddHintProvider HintProvider:  &{{0 0} 0x79a0338 10000000000 0xc0001810e0 <nil> <nil> <nil> <nil> map[memory:{{104857600 0} {<nil>}  BinarySI}]}
Adding pod path: /etc/kubernetes/manifests
Watching apiserver

#======这是我现在的问题。

def Registration():

rootA = Toplevel() # This creates the window, just a blank one.
    rootA.geometry("1366x768")
    rootA.configure(background="black")
    rootA.title('Registation') # This renames the title of said window to 'signup'
    rootA.attributes('-fullscreen', True)

    image3=Image.open('2.gif')
    image4=ImageTk.PhotoImage(image3)
    image3_label=Label(borderwidth=0)
    image3_label.grid(column=0,row=0)

    registrationLabel = Label(rootA, image=image4)
    registrationLabel.place(x=0,y=0)

    fnameEntry= Entry(rootA)
    fnameEntry.place(x=680,y=350,width=200)

def Login():
    global nameEL
    global pwordEL
    global rootA

    rootA = Tk() 
    rootA.geometry("1366x768")
    rootA.configure(background="black")
    rootA.attributes('-fullscreen', True)
    rootA.title('Food Delivery') # This makes the window title 'login'

    image2=Image.open('1.gif')
    image1=ImageTk.PhotoImage(image2)
    image2_label=Label(borderwidth=0)
    image2_label.grid(column=0,row=0)

    titleLabel = Label(rootA, image=image1)
    titleLabel.place(x=0,y=0)

##我不知道下一步是什么或正确的代码。预先感谢

1 个答案:

答案 0 :(得分:0)

您一次只能拥有一个Tk实例。如果需要其他窗口,请创建Toplevel的实例。

Tk的每个实例都与其他实例隔离。在其中一个变量中创建的变量,小部件和图像在其他变量中不可见。