So I've googled around on this error and found some others who've had this problem. But I can't seem to solve it for my own app.
I get the error from the bind event: def OnSelChanged(self, event):
...
def OnSelChanged(self, event):
item = event.GetItem()
print(self.tree.GetItemText(item))
Well, the error is correct. The wx.TreeCtrl object does not have
a GetItem method. What are you trying to do here? Is it
possible
you wanted GetSelection() instead?
-- Tim Roberts, ti...@probo.com Providenza & Boekelheide, Inc.
Hi Tim,I'm trying to get the text of the node when I click on the node. This is a directory of files and I want to grab the filename when I click on a given node.I'm pretty confused with these methods...I've not been able to get any of them to work.GetSelection()GetFocusedItem()GetItemText()
On Wednesday, April 21, 2021 at 9:15:18 AM UTC-7 Tim Roberts wrote:RF wrote:
So I've googled around on this error and found some others who've had this problem. But I can't seem to solve it for my own app.
I get the error from the bind event: def OnSelChanged(self, event):...
def OnSelChanged(self, event):
item = event.GetItem()
print(self.tree.GetItemText(item))
Well, the error is correct. The wx.TreeCtrl object does not have a GetItem method. What are you trying to do here? Is it possible you wanted GetSelection() instead?
-- Tim Roberts, ti...@probo.com Providenza & Boekelheide, Inc.
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/85152e3f-30ea-4c61-a20f-81c2a59581e7n%40googlegroups.com.
I indented the def OnSelChanged(self, event): function and it now works.Is that because tree was created inside the MainFrame class, so therefore, the bind has to be within the same block?
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/351ca3db-1a83-440a-acbe-7139d31ed93dn%40googlegroups.com.
I see. OK I will attach my code in the future. Good point.I downloaded the extras zip file and unzipped it. What do I do with these *.pdb files? Whay app opens them?
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/88b63d14-2359-418e-8f86-8993adb41f87n%40googlegroups.com.
Unless you are behind one of the nastier corporate firewalls the command line utility wxdemo will download the correct version of the demo, (if it hasn't already done so), unpack that demo (if it hasn't already) and then start the demo. (The wxdocs utility does the same for the documents).
Steve Barnes
From: wxpytho...@googlegroups.com <wxpytho...@googlegroups.com>
On Behalf Of Andrea Gavana
Sent: 21 April 2021 19:30
To: wxpytho...@googlegroups.com
Subject: Re: [wxPython-users] AttributeError: 'TreeCtrl' object has no attribute 'GetItem'
On Wed, 21 Apr 2021 at 20.25, RF <ralphf...@gmail.com> wrote:
I see. OK I will attach my code in the future. Good point.
I downloaded the extras zip file and unzipped it. What do I do with these *.pdb files? Whay app opens them?
You only need the demo, everything else is not necessary.
On Wednesday, April 21, 2021 at 10:55:42 AM UTC-7 Infinity77 wrote:
Hi,
On Wed, 21 Apr 2021 at 19:46, RF <ralphf...@gmail.com> wrote:
I indented the def OnSelChanged(self, event): function and it now works.
Is that because tree was created inside the MainFrame class, so therefore, the bind has to be within the same block?
When I said to properly format your code, I meant either attach a Python file to your message or make sure that your email client does not mess up the indentation. This is how you code looks on my GMail:
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/CAEf70bxisjXonS-KMGpaW3WuDsr4wEr%2Bqd2ipefco%2B0VSPWiwQ%40mail.gmail.com.