Comments (2)
Thank you for opening this issue!
As far as I understand it, the code is not at fault, exactly, but there may be some unclarity. The only way I could find to reproduce your issue is to insert an item in the following manner, modified from example_checkboxtreeview.py
:
tree = CheckboxTreeview(root)
tree.pack()
tree.insert("", "end", "1", text="1", tags=("hello","world"))
tree.insert("1", "end", "11", text="11", tags=("hello"))
This produces the error on Python 3.8:
Traceback (most recent call last):
File "/home/user/Source/ttkwidgets/examples/example_checkboxtreeview.py", line 15, in <module>
tree.insert("1", "end", "11", text="11", tags="hello")
File "/home/user/Source/ttkwidgets/ttkwidgets/checkboxtreeview.py", line 172, in insert
kw["tags"] += (tag,)
TypeError: can only concatenate str (not "tuple") to str
However, I think that the way Python handles the declaration of tuples is the cause of the confusion here. ("hello")
is not a tuple, it is a string:
>>> ("hello")
'hello'
whereas ("hello",)
is a tuple:
>>> ("hello",)
('hello',)
This is so that string declarations can be made to easily span multiple lines in Python by wrapping them in parentheses.
Therefore, the argument to tags
should always be wrapped in parentheses and, if it contains only a single element, the element must be followed by a comma.
If this is not what you are seeing, please let me know, because then it could be a proper bug that needs to be fixed. Of course, without seeing the whole code, I cannot determine with certainty that this is the cause of the confusion, but it is my best guess. I hope this helps you!
from ttkwidgets.
Indeed I was sloppy and was not declaring a tuple by appending ,
after a single string tuple. Sorry for newbie question. Thank you for the great answer!
from ttkwidgets.
Related Issues (20)
- ttkwidgets.Table error .... according to example code
- Overwritten configure methods don't return values
- AutocompleteCombobox has bug when type very quickly.
- Checkbox Treeview Image Replacing Checkbox HOT 2
- Is it possible to insert image along with ttkwidgets CheckboxTreeview
- Improvement ideas for ttkwidgets HOT 3
- Hooks and validated entries missing from Pypi package HOT 3
- Add screenshots in docs
- Library ttkwidgets==0.12.0 automatically installed under Python 2 HOT 3
- Merging new widgets
- checkboxTreeview: no highlighting row if selected HOT 1
- widgets don't work when using ScrolledFrame.
- Could not resolve import
- About timeline. HOT 1
- [Feature request] Get value range from Scale? HOT 1
- Autocomplete search match with case INSENSITIVE
- askfont - if I select first font type and then the size it don't work. HOT 1
- Change license to GNU LGPL instead of GPL? HOT 1
- Checkbox backgrounds HOT 1
- how to check AutocompleteCombobox is selected for calling a callback function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ttkwidgets.