[問題] tkinter找不到屬性Tk()

看板Python作者 (eddie)時間6年前發表 (2019/04/17 12:33), 6年前編輯推噓3(302)
留言5則, 5人參與, 6年前最新討論串1/1
最近在學習tkinter,使用spyder寫了下列程式 https://i.imgur.com/chMRGXP.jpg
但卻顯示 AttributeError: module 'tkinter' has no attribute 'Tk' ----- Sent from JPTT on my iPhone -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.205.14.121 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1555504436.A.EFA.html

04/17 20:52, 6年前 , 1F
你應該是檔名取到 tkinter 了 注意一下檔名
04/17 20:52, 1F
我在網路爬文有發現這個問題,但我已經把檔名改成abc.py了仍然會跑出錯誤訊息 ※ 編輯: hsiaoeddie (42.76.172.204), 04/18/2019 09:00:20

04/18 20:49, 6年前 , 2F
tkinter.__dict__檢查一下
04/18 20:49, 2F

04/19 10:33, 6年前 , 3F
同個資料夾內有tkinker嗎
04/19 10:33, 3F

04/19 23:20, 6年前 , 4F
我只注意到最後一行 Mainpool
04/19 23:20, 4F
哈哈哈哈我發現了,該回來了 ※ 編輯: hsiaoeddie (123.205.14.121), 04/20/2019 20:01:09

04/28 10:01, 6年前 , 5F
加一行 from tkinter import * ?
04/28 10:01, 5F
文章代碼(AID): #1Sjnqqxw (Python)