Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug window does not work #19

Closed
sigoa opened this issue Dec 26, 2017 · 1 comment
Closed

debug window does not work #19

sigoa opened this issue Dec 26, 2017 · 1 comment
Assignees

Comments

@sigoa
Copy link

sigoa commented Dec 26, 2017

from ttkwidgets import debugwindow
try:
import Tkinter as tk
import ttk
except ImportError:
import tkinter as tk
from tkinter import ttk

root = tk.Tk()
ttk.Button( root, text="Print 111", command="print(111)" ).pack()
debugwindow.DebugWindow(root)
print (222 , "this works, the button does not, all is broken" )
root.mainloop()

@RedFantom
Copy link
Member

Thank you for taking the time to open an issue report in our repository. For reference, I have formatted your code in the proper Markdown manner.

from ttkwidgets import debugwindow
try:
    import Tkinter as tk
    import ttk
except ImportError:
    import tkinter as tk
    from tkinter import ttk

root = tk.Tk()
ttk.Button(root, text="Print 111", command="print(111)").pack()
debugwindow.DebugWindow(root)
print(222, "this works, the button does not, all is broken")
root.mainloop()

It appears that you are using the command keyword argument for the creation of the Button in the wrong way. You see, when you pass the command kwarg, the expected value is a callable object. A string, as you have passed it, is not a callable. Instead, you should use a lambda-expression, like so:

ttk.Button(root, text="Print 111", command=lambda: print("111")).pack()

Therefore, this does not constitute a bug in the widget, and I will close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants