我有一個函數,在調用時不起作用,而同一縮進中的其他函數完美地工作這是我嘗試了很多東西但它們似乎不起作用的函數import tkinter as tk from tkinter import *from tkinter import ttkfrom tkinter.ttk import Progressbarfrom tkinter import messagebox import tkinter.font as font import mysql.connector as mys import time from time import sleep def Assign(): # TE Text Entry # TEfn Text Entry Flight number # TEp Text Entry Passengers # TEa Text Entry Airport # TEd Text Entry Distance def computing(): master=Tk() master.title('AMAS') photo=PhotoImage(file='AMAS.gif') #Image must be GIF Label(image=photo) # Line required to prevent python's garbage dump function Label(master,image=photo,fg='black',bg='black').grid(row=0,column=0,sticky=E) master.resizable(0,0) # Optional line to prevent the user from resizing the window master.mainloop() def dwindow(): print('dwindow called')#TEMP def saveTEd(): global Ed Ed=TEd.get() print(Ed) window.destroy() # Window Number 5 Called Below computing() window=Tk() window.title("Distance") window.configure(background='white') photo1=PhotoImage(file='Distance.gif') Label(image=photo1) Label(window,image=photo1,bg='white').grid(row=0,column=0,sticky=W) Label(window,text='Enter The Distance Travelled',bg='white',fg='black',font='none 12 bold').grid(row=1,column=0,sticky=W) TEd=Entry(window,width=20,bg='white') TEd.grid(row=2,column=0,sticky=W) Button(window,text='Enter',width=6,command=saveTEd).grid(row=3,column=0,sticky=W) mainloop() def awindow(): print('awindow called')#TEMP def saveDDMo(value): global DDMo DDMo=aoption.get() print(DDMo) window.destroy()我認為這可能是因為我正在導入或垃圾轉儲,但我似乎無法解決問題。我認為這可能是因為我正在導入或垃圾轉儲,但我似乎無法解決問題。我認為這可能是因為我正在導入或垃圾轉儲,但我似乎無法解決問題。
1 回答

眼眸繁星
TA貢獻1873條經驗 獲得超9個贊
這里的錯誤是image "pyimage2" doesn't exist
簡而言之,您不能同時運行兩個 Tk() 實例,您必須改用 Toplevel()。
添加回答
舉報
0/150
提交
取消