0
我有我的Mac上一些Python代碼寫臨上運行V2.7,安裝後小牛我的代碼沒有尺寸模塊上運行,說找不到模塊:OS X小牛隊後,我的代碼失敗
#!/usr/bin/python
from Tkinter import *
import tkFont
import Dimension
class Application(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
sz = Dimension(200, 200)
self.size(sz)
self.grid()
self.createWidgets()
def createWidgets(self):
ifont = tkFont.Font(family='Courier New', size=14)
self.quitButton = Button (self, text='Quit',
command=self.quit , font=ifont)
self.quitButton.grid()
self.openButton = Button (self, text='Open', command=self.quit)
self.openButton.grid()
app = Application()
app.master.title("Sample application")
app.mainloop()
錯誤:
Ganimedes:python denisbopp$ python tutor_01.py
Traceback (most recent call last):
File "tutor_01.py", line 4, in <module>
import Dimension
ImportError: No module named Dimension
而且你100%確定你有'Dimension.py'坐在那裏在同一個目錄中嗎? –