Emplicitly tag a row in tkinter treeview












-1















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.










share|improve this question

























  • @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
















-1















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.










share|improve this question

























  • @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














-1












-1








-1








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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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



















  • @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












1 Answer
1






active

oldest

votes


















0















Question: ... the other rows to have all their tags removed







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.







Treeview items before:



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 Treeview to get the iid of a item



    for iid in self.tree.get_children():



  • Condition: 'BadgeOfTheWeek' is not in current item(iid) tags.



        if not 'BadgeOfTheWeek' in self.tree.item(iid)['tags']:



  • To remove all tags from this item(iid), set tags= to a empty list or set



            self.tree.item(iid, tags=)




Treeview items after:



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






share|improve this answer























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    0















    Question: ... the other rows to have all their tags removed







    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.







    Treeview items before:



    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 Treeview to get the iid of a item



      for iid in self.tree.get_children():



    • Condition: 'BadgeOfTheWeek' is not in current item(iid) tags.



          if not 'BadgeOfTheWeek' in self.tree.item(iid)['tags']:



    • To remove all tags from this item(iid), set tags= to a empty list or set



              self.tree.item(iid, tags=)




    Treeview items after:



    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






    share|improve this answer




























      0















      Question: ... the other rows to have all their tags removed







      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.







      Treeview items before:



      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 Treeview to get the iid of a item



        for iid in self.tree.get_children():



      • Condition: 'BadgeOfTheWeek' is not in current item(iid) tags.



            if not 'BadgeOfTheWeek' in self.tree.item(iid)['tags']:



      • To remove all tags from this item(iid), set tags= to a empty list or set



                self.tree.item(iid, tags=)




      Treeview items after:



      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






      share|improve this answer


























        0












        0








        0








        Question: ... the other rows to have all their tags removed







        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.







        Treeview items before:



        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 Treeview to get the iid of a item



          for iid in self.tree.get_children():



        • Condition: 'BadgeOfTheWeek' is not in current item(iid) tags.



              if not 'BadgeOfTheWeek' in self.tree.item(iid)['tags']:



        • To remove all tags from this item(iid), set tags= to a empty list or set



                  self.tree.item(iid, tags=)




        Treeview items after:



        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






        share|improve this answer














        Question: ... the other rows to have all their tags removed







        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.







        Treeview items before:



        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 Treeview to get the iid of a item



          for iid in self.tree.get_children():



        • Condition: 'BadgeOfTheWeek' is not in current item(iid) tags.



              if not 'BadgeOfTheWeek' in self.tree.item(iid)['tags']:



        • To remove all tags from this item(iid), set tags= to a empty list or set



                  self.tree.item(iid, tags=)




        Treeview items after:



        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







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 1 at 14:09









        stovflstovfl

        7,76131031




        7,76131031
































            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Mossoró

            Error while reading .h5 file using the rhdf5 package in R

            Pushsharp Apns notification error: 'InvalidToken'