[wxPython] some Q in GUI control designs!

Hi Folks,

Here I've come up some q in mind,

1) How can i disable the tree items in wxTreeCtrl

2) How can i hide and show a particular page in wxNodeBook Ctrl

I have tried , but not working

        page2 = self.nb.GetPage(2)
        page2.Show(false)

3) Dynamic creation of ctrls in a panel:

I post the sample code, but seems to be buggy......

<<mypage.ZIP>>
import MyPage class which was derived from wxPanel, when i try to add this
as one of the page in notebook and "<--"
btn is not working as i expecting. I don't know where i'm wrong.

4) This is regarding adding rows in wxListCtrl

I'm trying below codes to add rows in wxListCtrl, but not showing in
ListCtrl.

mypage.ZIP (881 Bytes)

···

--------

      list = wxListCtrl(self, -1,
style=wxLC_REPORT|wxSUNKEN_BORDER|wxLC_EDIT_LABELS )
        
        list.InsertColumn(0, "Col1")
        list.InsertColumn(1, "Col2")
        
        items = myData.items()
        for x in range(len(items)):
            key, data = items[x]
            #list.InsertImageStringItem(x, data[0], idx1)
            list.SetStringItem(x, 0, data[0])
            print "%s" % data[0]
            print "%s" % data[1]
            print "%s" % x
             
            list.SetStringItem(x, 1, data[1])
            list.SetItemData(x, key)
        
        list.SetStringItem(0, 0, "M1")
        list.SetStringItem(0, 1, "T1")
        list.SetItemData(0,1)
        
        list.SetStringItem(1, 0, "M2")
        list.SetStringItem(1, 1, "T2")
        list.SetItemData(1,2)
---------

Thanks for any help in finding the error in my approach
Maharajan

1) How can i disable the tree items in wxTreeCtrl

You'll probably have to fake it by changing the item's font or something and
then not responding to the various events for it.

2) How can i hide and show a particular page in wxNodeBook Ctrl

I have tried , but not working

        page2 = self.nb.GetPage(2)
        page2.Show(false)

If you want to get rid of the page including the notebook tab then use
wxNotebook.RemovePage. If just the contents then I would have expected the
above to work but as I think about it a bit more it makes sense that the
notbook always ensures that it's pages are visible. You may have to get
creative and RemovePage followed by InsertPage with an empty wxPanel.
Another alternative is to put an extra layer in the pages so you have
wxPanel --> wxPanel --> pagecontent. Then if you Hide the second panel then
your content should be hidden but the first panel will still be shown by the
notebook.

3) Dynamic creation of ctrls in a panel:

I post the sample code, but seems to be buggy......

I don't have time to look at it unless it is a fully funcitoning sample, not
just part of your code.

<<mypage.ZIP>>
import MyPage class which was derived from wxPanel, when i try to add this
as one of the page in notebook and "<--"
btn is not working as i expecting. I don't know where i'm wrong.

What are you expecting? What is it doing instead?

4) This is regarding adding rows in wxListCtrl

I'm trying below codes to add rows in wxListCtrl, but not showing in
ListCtrl.

You always have to do one of the Insert methods to add an item to a list
ctrl.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!