首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用ActiveTcl8.5.14和Python 2.7,什么是好的在线资源?

使用ActiveTcl8.5.14和Python 2.7,什么是好的在线资源?
EN

Stack Overflow用户
提问于 2013-08-18 13:57:08
回答 1查看 144关注 0票数 1

我正在尝试使用Tkinter和Python2.7编写我的第一个程序。我安装的Tkinter库是: ActiveTcl8.5.14。我的问题是:对于这种组合,什么是好的在线资源?我一直在不断地尝试和犯错,但现在我被卡住了。我正在尝试将stringVar设置为文件名。但我担心我使用的代码是针对错误版本的Python或Tkinter的。

代码语言:javascript
复制
def abrir_capitulo():
    ##Dialog box for selecting the chapter to be loaded.
    import tkFileDialog
    WORDLIST_FILENAME = tkFileDialog.askopenfilename(mode='r',parent=master,title="Archivo para abrir")

这是回溯:

代码语言:javascript
复制
Exception in Tkinter callback
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1470, in __call__
    return self.func(*args)
  File "/Users/Noel/Documents/Professional Development/MIT CS 6.0/Recall Game/Recall_Game.py", line 103, in abrir_capitulo
    WORDLIST_FILENAME = tkFileDialog.askopenfilename(mode='r',parent=master,title="Archivo para abrir")
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/tkFileDialog.py", line 125, in askopenfilename
    return Open(**options).show()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/tkCommonDialog.py", line 48, in show
    s = w.tk.call(self.command, *w._options(self.options))
TclError: bad option "-mode": must be -defaultextension, -filetypes, -initialdir, -initialfile, -message, -multiple, -parent, -title, -typevariable, or -command
EN

回答 1

Stack Overflow用户

发布于 2013-08-18 14:02:10

根据askopenfilename documentation的说法,askopenfilename没有mode参数。

代码语言:javascript
复制
WORDLIST_FILENAME = tkFileDialog.askopenfilename(parent=master,title="Archivo para abrir")

有关文档,请参阅http://wiki.python.org/moin/TkInter

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18296169

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档