Emplicitly tag a row in tkinter treeview
I am trying to tag a single row in a treeview column when it is selected.
BadgesView.tag_configure("BadgeOfTheWeek", background="yellow")
Before or after this row is tagged I want the other rows to have all their tags removed by the program.
for row in Treeview:
remove tag from row.
I am not sure if this is possible, as I am having a hard time identifying which row is the selected row, and from that which row to tag.
Any help is appreciated.
python tkinter treeview
add a comment |
I am trying to tag a single row in a treeview column when it is selected.
BadgesView.tag_configure("BadgeOfTheWeek", background="yellow")
Before or after this row is tagged I want the other rows to have all their tags removed by the program.
for row in Treeview:
remove tag from row.
I am not sure if this is possible, as I am having a hard time identifying which row is the selected row, and from that which row to tag.
Any help is appreciated.
python tkinter treeview
@stovfl I want the program to remove all tags associated with each row. Sorry for lack of clarity.
– Lyra Orwell
Dec 31 '18 at 16:04
Dahm, that's a shame :(
– Lyra Orwell
Dec 31 '18 at 16:52
1
I think saying they are readonly is false. You can change the tags at any time, including changing them to an empty set.
– Bryan Oakley
Dec 31 '18 at 19:33
add a comment |
I am trying to tag a single row in a treeview column when it is selected.
BadgesView.tag_configure("BadgeOfTheWeek", background="yellow")
Before or after this row is tagged I want the other rows to have all their tags removed by the program.
for row in Treeview:
remove tag from row.
I am not sure if this is possible, as I am having a hard time identifying which row is the selected row, and from that which row to tag.
Any help is appreciated.
python tkinter treeview
I am trying to tag a single row in a treeview column when it is selected.
BadgesView.tag_configure("BadgeOfTheWeek", background="yellow")
Before or after this row is tagged I want the other rows to have all their tags removed by the program.
for row in Treeview:
remove tag from row.
I am not sure if this is possible, as I am having a hard time identifying which row is the selected row, and from that which row to tag.
Any help is appreciated.
python tkinter treeview
python tkinter treeview
edited Jan 7 at 21:12
marc_s
576k12911111258
576k12911111258
asked Dec 31 '18 at 13:48
Lyra OrwellLyra Orwell
887
887
@stovfl I want the program to remove all tags associated with each row. Sorry for lack of clarity.
– Lyra Orwell
Dec 31 '18 at 16:04
Dahm, that's a shame :(
– Lyra Orwell
Dec 31 '18 at 16:52
1
I think saying they are readonly is false. You can change the tags at any time, including changing them to an empty set.
– Bryan Oakley
Dec 31 '18 at 19:33
add a comment |
@stovfl I want the program to remove all tags associated with each row. Sorry for lack of clarity.
– Lyra Orwell
Dec 31 '18 at 16:04
Dahm, that's a shame :(
– Lyra Orwell
Dec 31 '18 at 16:52
1
I think saying they are readonly is false. You can change the tags at any time, including changing them to an empty set.
– Bryan Oakley
Dec 31 '18 at 19:33
@stovfl I want the program to remove all tags associated with each row. Sorry for lack of clarity.
– Lyra Orwell
Dec 31 '18 at 16:04
@stovfl I want the program to remove all tags associated with each row. Sorry for lack of clarity.
– Lyra Orwell
Dec 31 '18 at 16:04
Dahm, that's a shame :(
– Lyra Orwell
Dec 31 '18 at 16:52
Dahm, that's a shame :(
– Lyra Orwell
Dec 31 '18 at 16:52
1
1
I think saying they are readonly is false. You can change the tags at any time, including changing them to an empty set.
– Bryan Oakley
Dec 31 '18 at 19:33
I think saying they are readonly is false. You can change the tags at any time, including changing them to an empty set.
– Bryan Oakley
Dec 31 '18 at 19:33
add a comment |
1 Answer
1
active
oldest
votes
Question: ... the other
rowsto have all theirtagsremoved
Tkinter 8.5 reference - 45. ttk.Treeview
First, some definitions:item
One of the entities being displayed in the widget. For a file browser, an item might be either a directory or a file.
Each item is associated with a textual label, and may also be associated with an image.iid
Every item in the tree has a unique identifier string called the iid. You can supply the iid values yourself, or you can let ttk generate them.
Treeviewitemsbefore:
item:{'text': 'Text_1', 'values': '', 'tags': ['ALL'], 'image': '', 'open': 0}
item:{'text': 'Text_2', 'values': '', 'tags': ['BadgeOfTheWeek', 'ALL'], 'image': '', 'open': 0}
item:{'text': 'Text_3', 'values': '', 'tags': ['ALL'], 'image': '', 'open': 0}
Loop the
Treeviewto get theiidof a item
for iid in self.tree.get_children():
Condition:
'BadgeOfTheWeek'isnot incurrentitem(iid)tags.
if not 'BadgeOfTheWeek' in self.tree.item(iid)['tags']:
To remove all
tagsfrom thisitem(iid), settags=to a emptylistorset
self.tree.item(iid, tags=)
Treeviewitemsafter:
item:{'text': 'Text_1', 'values': '', 'tags': '', 'image': '', 'open': 0}
item:{'text': 'Text_2', 'values': '', 'tags': ['BadgeOfTheWeek', 'ALL'], 'image': '', 'open': 0}
item:{'text': 'Text_3', 'values': '', 'tags': '', 'image': '', 'open': 0}
Tested with Python: 3.5 - TkVersion: 8.6
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53988213%2femplicitly-tag-a-row-in-tkinter-treeview%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Question: ... the other
rowsto have all theirtagsremoved
Tkinter 8.5 reference - 45. ttk.Treeview
First, some definitions:item
One of the entities being displayed in the widget. For a file browser, an item might be either a directory or a file.
Each item is associated with a textual label, and may also be associated with an image.iid
Every item in the tree has a unique identifier string called the iid. You can supply the iid values yourself, or you can let ttk generate them.
Treeviewitemsbefore:
item:{'text': 'Text_1', 'values': '', 'tags': ['ALL'], 'image': '', 'open': 0}
item:{'text': 'Text_2', 'values': '', 'tags': ['BadgeOfTheWeek', 'ALL'], 'image': '', 'open': 0}
item:{'text': 'Text_3', 'values': '', 'tags': ['ALL'], 'image': '', 'open': 0}
Loop the
Treeviewto get theiidof a item
for iid in self.tree.get_children():
Condition:
'BadgeOfTheWeek'isnot incurrentitem(iid)tags.
if not 'BadgeOfTheWeek' in self.tree.item(iid)['tags']:
To remove all
tagsfrom thisitem(iid), settags=to a emptylistorset
self.tree.item(iid, tags=)
Treeviewitemsafter:
item:{'text': 'Text_1', 'values': '', 'tags': '', 'image': '', 'open': 0}
item:{'text': 'Text_2', 'values': '', 'tags': ['BadgeOfTheWeek', 'ALL'], 'image': '', 'open': 0}
item:{'text': 'Text_3', 'values': '', 'tags': '', 'image': '', 'open': 0}
Tested with Python: 3.5 - TkVersion: 8.6
add a comment |
Question: ... the other
rowsto have all theirtagsremoved
Tkinter 8.5 reference - 45. ttk.Treeview
First, some definitions:item
One of the entities being displayed in the widget. For a file browser, an item might be either a directory or a file.
Each item is associated with a textual label, and may also be associated with an image.iid
Every item in the tree has a unique identifier string called the iid. You can supply the iid values yourself, or you can let ttk generate them.
Treeviewitemsbefore:
item:{'text': 'Text_1', 'values': '', 'tags': ['ALL'], 'image': '', 'open': 0}
item:{'text': 'Text_2', 'values': '', 'tags': ['BadgeOfTheWeek', 'ALL'], 'image': '', 'open': 0}
item:{'text': 'Text_3', 'values': '', 'tags': ['ALL'], 'image': '', 'open': 0}
Loop the
Treeviewto get theiidof a item
for iid in self.tree.get_children():
Condition:
'BadgeOfTheWeek'isnot incurrentitem(iid)tags.
if not 'BadgeOfTheWeek' in self.tree.item(iid)['tags']:
To remove all
tagsfrom thisitem(iid), settags=to a emptylistorset
self.tree.item(iid, tags=)
Treeviewitemsafter:
item:{'text': 'Text_1', 'values': '', 'tags': '', 'image': '', 'open': 0}
item:{'text': 'Text_2', 'values': '', 'tags': ['BadgeOfTheWeek', 'ALL'], 'image': '', 'open': 0}
item:{'text': 'Text_3', 'values': '', 'tags': '', 'image': '', 'open': 0}
Tested with Python: 3.5 - TkVersion: 8.6
add a comment |
Question: ... the other
rowsto have all theirtagsremoved
Tkinter 8.5 reference - 45. ttk.Treeview
First, some definitions:item
One of the entities being displayed in the widget. For a file browser, an item might be either a directory or a file.
Each item is associated with a textual label, and may also be associated with an image.iid
Every item in the tree has a unique identifier string called the iid. You can supply the iid values yourself, or you can let ttk generate them.
Treeviewitemsbefore:
item:{'text': 'Text_1', 'values': '', 'tags': ['ALL'], 'image': '', 'open': 0}
item:{'text': 'Text_2', 'values': '', 'tags': ['BadgeOfTheWeek', 'ALL'], 'image': '', 'open': 0}
item:{'text': 'Text_3', 'values': '', 'tags': ['ALL'], 'image': '', 'open': 0}
Loop the
Treeviewto get theiidof a item
for iid in self.tree.get_children():
Condition:
'BadgeOfTheWeek'isnot incurrentitem(iid)tags.
if not 'BadgeOfTheWeek' in self.tree.item(iid)['tags']:
To remove all
tagsfrom thisitem(iid), settags=to a emptylistorset
self.tree.item(iid, tags=)
Treeviewitemsafter:
item:{'text': 'Text_1', 'values': '', 'tags': '', 'image': '', 'open': 0}
item:{'text': 'Text_2', 'values': '', 'tags': ['BadgeOfTheWeek', 'ALL'], 'image': '', 'open': 0}
item:{'text': 'Text_3', 'values': '', 'tags': '', 'image': '', 'open': 0}
Tested with Python: 3.5 - TkVersion: 8.6
Question: ... the other
rowsto have all theirtagsremoved
Tkinter 8.5 reference - 45. ttk.Treeview
First, some definitions:item
One of the entities being displayed in the widget. For a file browser, an item might be either a directory or a file.
Each item is associated with a textual label, and may also be associated with an image.iid
Every item in the tree has a unique identifier string called the iid. You can supply the iid values yourself, or you can let ttk generate them.
Treeviewitemsbefore:
item:{'text': 'Text_1', 'values': '', 'tags': ['ALL'], 'image': '', 'open': 0}
item:{'text': 'Text_2', 'values': '', 'tags': ['BadgeOfTheWeek', 'ALL'], 'image': '', 'open': 0}
item:{'text': 'Text_3', 'values': '', 'tags': ['ALL'], 'image': '', 'open': 0}
Loop the
Treeviewto get theiidof a item
for iid in self.tree.get_children():
Condition:
'BadgeOfTheWeek'isnot incurrentitem(iid)tags.
if not 'BadgeOfTheWeek' in self.tree.item(iid)['tags']:
To remove all
tagsfrom thisitem(iid), settags=to a emptylistorset
self.tree.item(iid, tags=)
Treeviewitemsafter:
item:{'text': 'Text_1', 'values': '', 'tags': '', 'image': '', 'open': 0}
item:{'text': 'Text_2', 'values': '', 'tags': ['BadgeOfTheWeek', 'ALL'], 'image': '', 'open': 0}
item:{'text': 'Text_3', 'values': '', 'tags': '', 'image': '', 'open': 0}
Tested with Python: 3.5 - TkVersion: 8.6
answered Jan 1 at 14:09
stovflstovfl
7,76131031
7,76131031
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53988213%2femplicitly-tag-a-row-in-tkinter-treeview%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
@stovfl I want the program to remove all tags associated with each row. Sorry for lack of clarity.
– Lyra Orwell
Dec 31 '18 at 16:04
Dahm, that's a shame :(
– Lyra Orwell
Dec 31 '18 at 16:52
1
I think saying they are readonly is false. You can change the tags at any time, including changing them to an empty set.
– Bryan Oakley
Dec 31 '18 at 19:33