ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> wxpython-users
wxpython-users
[wxpython-users] Testing events, I'm missing the gist
by Rohan other posts by this author
May 28 2009 5:25AM messages near this date
Re: [wxpython-users] drag in toolbar | Re: [wxpython-users] Testing events, I'm missing the gist
Good inhabitants of this list,

While attempting to test my naughty control
I wrote some doctests covering the whole
But when it came to a sent text event
Wx did its best to prevent
Success.

Many paths in my quest I wandered
Many hours in futility squandered
Many googled wx docs read I
Many prayers did I send to the sky...
Nothing.

All I wanted was a handler to test.
Send an event wrapped char to rest,
After traversing bound method to Skip()
To yon text field's furthest lip
Blank.

I conversed with friends of diverse name
EmulateKeyPress, wx.KeyEvent, the selfsame.
Events I created and ruefully spent
sending to GetEventHandler().ProcessEvent()
None.

The ProcessEvent finally filled me with hope
The event traversed the bound method's scope
Then reaching the end leaped through event.Skip
Never to be seen, nay, nary a blip.
0x00000000

My question to all, as I was wonderin':
Where is my char after all that conjurin'?
I am perplexed, and my tests are dissolute
Having no purpose, their depression's acute.
:(

Below is a sample of what I was trying.
In development, by pants I am currently flying
I cannot regress or refactor with aplomb
With only debugger and luck I will bomb
Eventually.

Ta for reactions in advance of posting
I return with debugger to merry code-roasting.
I hope you will forgive my horrible rhyming,
And I'm not really pleased at all with the timing.
Thanks.


8<--------------------------------------------------------

 > >> app = wx.App()
 > >> app.frame = wx.Frame(None, -1)
 > >> app.pan = wx.Panel(app.frame, -1)
 > >> c = wx.TextCtrl(app.pan, -1)
 > >> c.AppendText('a')
 > >> c.GetInsertionPoint()
1
 > >> len(c.GetValue())
1

Now we want to pass the event of adding a b
 > >> event = wx.KeyEvent(wx.wxEVT_CHAR)
 > >> event.m_keyCode = ord('a')
 > >> event.GetKeyCode()
97
 > >> c.SetFocus()
 > >> c.GetEventHandler().ProcessEvent(event)
False
 > >> event.Skip()
 > >> c.GetValue()
u''
 > >> c.GetEventHandler().ProcessEvent(event)
False
 > >> c.GetValue()
u'a'

This fails when run, as c.GetValue() still has u''
_______________________________________________
wxpython-users mailing list
wxpython-users@[...].org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Thread:
Rohan
Mike Driscoll
Rohan
Steven Sproat

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved