473,382 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

wxPython GenericDirCtrl events

I can't get these to work, and I can't work out what I'm doing wrong.
I added the following lines to the GenericDirCtrl.py demo in the
wxython demos folder:

at the end TestPanel.__init__ I added:

self.Bind(wx.EVT_TREE_SEL_CHANGED, self.test, dir1)

and also added a test def to the class:

def test(self, evt):
print "Hit"

When I run it I never get a hit. How should I be doing this?

Iain

-----------
source:
-----------

import wx

#----------------------------------------------------------------------

class TestPanel(wx.Panel):
def __init__(self, parent, log):
wx.Panel.__init__(self, parent, -1)
self.log = log

txt1 = wx.StaticText(self, -1, "style=0")
dir1 = wx.GenericDirCtrl(self, -1, size=(200,225), style=0)

txt2 = wx.StaticText(self, -1, "wx.DIRCTRL_DIR_ONLY")
dir2 = wx.GenericDirCtrl(self, -1, size=(200,225),
style=wx.DIRCTRL_DIR_ONLY)

txt3 = wx.StaticText(self, -1, "wx.DIRCTRL_SHOW_FILTERS")
dir3 = wx.GenericDirCtrl(self, -1, size=(200,225),
style=wx.DIRCTRL_SHOW_FILTERS,
filter="All files (*.*)|*.*|Python
files (*.py)|*.py")

sz = wx.FlexGridSizer(cols=3, hgap=5, vgap=5)
sz.Add((35, 35)) # some space above
sz.Add((35, 35))
sz.Add((35, 35))

sz.Add(txt1)
sz.Add(txt2)
sz.Add(txt3)

sz.Add(dir1, 0, wx.EXPAND)
sz.Add(dir2, 0, wx.EXPAND)
sz.Add(dir3, 0, wx.EXPAND)

sz.Add((35,35)) # some space below

sz.AddGrowableRow(2)
sz.AddGrowableCol(0)
sz.AddGrowableCol(1)
sz.AddGrowableCol(2)

self.SetSizer(sz)
self.SetAutoLayout(True)

self.Bind(wx.EVT_TREE_SEL_CHANGED, self.test, dir1)

def test(self, evt):
print "Hit"
#----------------------------------------------------------------------

def runTest(frame, nb, log):
win = TestPanel(nb, log)
return win

#----------------------------------------------------------------------
overview = """\
This control can be used to place a directory listing (with optional
files)
on an arbitrary window. The control contains a TreeCtrl window
representing
the directory hierarchy, and optionally, a Choice window containing a
list
of filters.

The filters work in the same manner as in FileDialog.

"""
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])

Mar 8 '06 #1
2 2725
On 8 Mar 2006 04:25:38 -0800, "Iain King" <ia******@gmail.com> wrote:

at the end TestPanel.__init__ I added:

self.Bind(wx.EVT_TREE_SEL_CHANGED, self.test, dir1)
{...]


Try this instead:

t = dir1.GetTreeCtrl()
t.Bind(wx.EVT_TREE_SEL_CHANGED, self.test)
--
Franz Steinhaeusler
Mar 8 '06 #2

Franz Steinhaeusler wrote:
On 8 Mar 2006 04:25:38 -0800, "Iain King" <ia******@gmail.com> wrote:

at the end TestPanel.__init__ I added:

self.Bind(wx.EVT_TREE_SEL_CHANGED, self.test, dir1)
{...]


Try this instead:

t = dir1.GetTreeCtrl()
t.Bind(wx.EVT_TREE_SEL_CHANGED, self.test)
--
Franz Steinhaeusler


Perfect. Thanks!

Iain

Mar 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Grant Edwards | last post by:
Can anybody recommend a good book on wxPython? Are there any books on wxPython? I've been trying to learn wxPython and/or wax for a few weeks, and I'm just not getting it. wxWindows seems...
25
by: BJörn Lindqvist | last post by:
See: http://www.wxpython.org/quotes.php. especially: "wxPython is the best and most mature cross-platform GUI toolkit, given a number of constraints. The only reason wxPython isn't the standard...
0
by: Robin Dunn | last post by:
Announcing ---------- The 2.6.3.0 release of wxPython is now available for download at http://wxpython.org/download.php. There have been many enhancements and fixes implemented in this...
0
by: Robin Dunn | last post by:
Announcing ---------- The 2.6.3.0 release of wxPython is now available for download at http://wxpython.org/download.php. There have been many enhancements and fixes implemented in this...
0
by: Robin Dunn | last post by:
Announcing ---------- The 2.6.3.2 release of wxPython is now available for download at http://wxpython.org/download.php. This is a mostly bug fix release and takes care of several "unfortunate...
1
by: vedrandekovic | last post by:
Hello, How can I Insert image with string in ListCtrl with this example: # Import ftputil module - like ftplib from ftputil import FTPHost # Create connection...
1
by: SMALLp | last post by:
How to? I couldn't find anything except EVT_ENTER_WINDOW that didn't work.
4
by: Jimmy | last post by:
hi, all I'm having a problem with creating custom events in wxpython. I have a class A handling some data processing work and another class B of GUI matter. I need GUI to display information...
16
by: Andrea Gavana | last post by:
Hi Diez & All, Do you mind explaining "why" you find it *buttugly*? I am asking just out of curiosity, obviously. I am so biased towards wxPython that I won't make any comment on this thread...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.