まず、実際の問題は何か分かりませんので、より正確なタイトルを考え出すことができませんでした。あなたの中には、正確に編集できる人もいるかもしれません。tkinter.TclError:無効なコマンド名 "テーブル"
以下は、私が抱えている問題を再現するための最小化されたコードです。
from traybar import SysTrayIcon
from cal import Calendar
import Tkinter
class Add():
def __init__(self,master):
Calendar(master).pack()
def add(systray):
root = Tkinter.Tk()
Add(root)
root.mainloop()
SysTrayIcon("abc.ico","abc", (('Add',None, add),) ,default_menu_index=0).start()
cal
とtrabar
は、それぞれ、これらのファイルhttp://tkinter.unpythonic.net/wiki/TkTableCalendarとhttps://github.com/Infinidat/infi.systray/blob/develop/src/infi/systray/traybar.pyです。
これを実行すると、Windowsマシンのシステムトレイに、Add
とのオプションを持つアイコンが作成されます。 app
をクリックするとカレンダーが開きますが問題ありません。カレンダーを閉じてAdd
を再度クリックします。しかし、今回はそれがカレンダーを開いて、あなたは、このエラーのdoesnシンプルTkinter
Button
またはLabel
などを使用している場合、私はCalendar
のCalendar
.InsteadでSysTrayIcon
を使用する場合、この問題がのみ表示されます、次のエラーに
`
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 314, in 'calling callback function'
File "C:\Users\Koushik Naskar\AppData\Roaming\Python\Python27\site-packages\traybar.py", line 79, in WndProc
self._message_dict[msg](hwnd, msg, wparam.value, lparam.value)
File "C:\Users\Koushik Naskar\AppData\Roaming\Python\Python27\site-packages\traybar.py", line 276, in _command
self._execute_menu_option(id)
File "C:\Users\Koushik Naskar\AppData\Roaming\Python\Python27\site-packages\traybar.py", line 283, in _execute_menu_option
menu_action(self)
File "C:\Users\Koushik Naskar\Desktop\So\temp.py", line 11, in add
Add(root)
File "C:\Users\Koushik Naskar\Desktop\So\temp.py", line 7, in __init__
Calendar(master).pack()
File "C:\Users\Koushik Naskar\Desktop\So\cal.py", line 66, in __init__
state='disabled', browsecommand=self._set_selection)
File "C:\Python27\lib\lib-tk\tktable.py", line 118, in __init__
Tkinter.Widget.__init__(self, master, 'table', kw)
File "C:\Python27\lib\lib-tk\Tkinter.py", line 2090, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: invalid command name "table"
`
をスローしません。表示されません。また、通常のTkinter GUIでは、Calendar
ウィジェット(通常はSysTrayIcon
なし)を何度でも使用することができます。エラーは何も起こりません。今ここで起こっていることと、これを修正する方法について何も手がかりがありません。 SysTrayIcon
にはどのような問題がありますか?と、GUIを初めて開くときにエラーが発生しないのはなぜですか?助けてください。
1回目のエラーや、通常のTkinter GUIで 'カレンダー'ウィジェットを使用したときに、何もエラーが発生しないのはなぜですか? – Eular