messagebox error: AttributeError: 'str' object has no attribute 'invoke'
See original GitHub issueDesktop (please complete the following information):
ttkbootstrap Version [1.8.0] --> pip3 install ttkbootstrap-master.zip OS: Linux Mint Cinnamon x64 X11
Describe the bug
When pressing the Enter button in a message box, it displays error:
~/.local/lib/python3.8/site-packages/ttkbootstrap/window.py", line 45, in <lambda> window.bind_class(“TButton”, “<Key-Return>”, lambda event: event.widget.invoke()) AttributeError: ‘str’ object has no attribute ‘invoke’
To Reproduce
import tkinter as tk
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
from tkinter import messagebox as msg
root = ttk.Window()
def show_msg():
msg.showwarning('Warning', 'Test!', parent=root)
return
b1 = ttk.Button(root, text="Button 1", bootstyle=SUCCESS, command=show_msg)
b1.pack(side=LEFT, padx=5, pady=10)
root.mainloop()
Using the code above,
- Click on the Button 1 button
- a message will be displayed on the screen
- I press the “Enter” key (Return) and the error occurs.
Expected behavior
Pressing Enter should close the message box without displaying an error.
And as soon as you have time, if possible, also ‘bind’ the <KP_Enter> key in the same event on the <Return> screen for that event
Screenshots
No response
Additional context
No response
Issue Analytics
- State:
- Created a year ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
class - Python - str' object has no attribute 'studentsinTeam'
When I try to do this, it produces AttributeError: 'str' object has no attribute 'studentsinTeam'. Im not entirely sure how to fix this....
Read more >AttributeError: 'str' object has no attribute 'pre' #160 - GitHub
I want to lint my Python code, using invoke to call the individual lint programs. Instead of running the programs, invoke throws an...
Read more >AttributeError: 'str' object has no attribute 'fetch' - Python Help
I'm trying to get working the python code at the following website: After several days I'm still not able to succeed since it...
Read more >AttributeError: 'str' object has no attribute 'send' : r/learnpython
Im trying to get text from a entry in tkinter and send it to the server but it keeps doing this.
Read more >QMessageBox — Qt for Python - Qt Documentation
Constructs a message box with no text and no buttons. parent is passed to the QDialog constructor. On macOS, if you want your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@antrrax, sorry, forgot to push the change to that branch. It should be there now.
@antrrax, I setup a Linux VM and tested it there. The messagebox you are using has an embedded Tcl/Tk button. So, what I did was called the invoke command on the Tcl/Tk widget directly when there is not an associated Python object. This should work for any embedded button that is not represented by a Python object. Try installing this again and see if it works on your distro: