TBC Macros and Extensions

 View Only
Expand all | Collapse all

Tkinter and TreeView - Any experience with Tkinter?

  • 1.  Tkinter and TreeView - Any experience with Tkinter?

    Posted 12-09-2021 10:50
    Hi guys,

    I´ve been struggling to get proper TreeViews on my macros and therefore was looking for alternatives and Tkinter sounds like a great module supporting a lot of things but especially what I need for TreeViews on my macros.

    I already have some simple TreeView on my macros  but would like to extend them and I don´t find the way with simple properties, etc such us .Items.Add(XXX) or Items.GetItemAt(Y) etc.

    Has anyone any experience using Tkinter for TMLs? I´ve tried many ways for several times in the last weeks but unfortunately with no success... :-(

    Thanks.

    Regards,
    Fernando

    ------------------------------
    Fernando Calvo
    calvo@calvo-geospatial.com
    ------------------------------


  • 2.  RE: Tkinter and TreeView - Any experience with Tkinter?

    Posted 11-03-2023 03:44

    Hi all,

    coming back to this thread that I posted back in 2021 in case anyone or the TBC team can provide any feedback.

    Thanks a lot.

    Regards,

    Fernando



    ------------------------------
    Fernando Calvo
    calvo@calvo-geospatial.com
    ------------------------------



  • 3.  RE: Tkinter and TreeView - Any experience with Tkinter?

    Posted 11-03-2023 07:37

    Why you are not using the default .NET Framework  TreeView  instead of third party. It's far richer and there's no need for an external reference. see below. IronPython is heavily .NET than being Python. Here is the sample code for TreeView in IronPython

    here is XAML piece: 

                        <TreeView x:Name="MyTreeView"  Padding="0 0 0 0" Margin="4 4 4 4" Background="Gainsboro">
                            <TreeViewItem Header="MyHeader:" FontWeight="Regular" FontSize="12" HorizontalAlignment="Left" />
                            <TreeView.Resources>
    
                                <Style TargetType="Border">
                                    <Setter Property="CornerRadius" Value="3">
    
                                    </Setter>
                                </Style>
                            </TreeView.Resources>
    
                        </TreeView>

    here is how you add item to TreeView:

    mytreeViewItem=TreeViewItem()
    
    myTreeViewItem.Header="Something"
    
    MyTreeView.Add(mytreeViewItem)
    

    and I guess it looks better than external here's the example:



    ------------------------------
    Morteza Kiani
    ------------------------------



  • 4.  RE: Tkinter and TreeView - Any experience with Tkinter?

    Posted 11-03-2023 07:42

    Hi Morteza,

    thanks for your answer. Yes, I have been using the standard one but wanted to do something more sofisticated and so far I found on the web, everywhere is tkinter the recommended solution.

    Thanks.

    Regards,

    Fernando



    ------------------------------
    Fernando Calvo
    calvo@calvo-geospatial.com
    ------------------------------