[wxpython-users] Gtk: SetMark on Combobox

Mike Driscoll mdriscoll at co.marshall.ia.us
Wed Apr 2 10:43:10 PDT 2008


Franz Steinhaeusler wrote:
> On Tue, 01 Apr 2008 14:44:44 -0700, Robin Dunn wrote:
>
>   
>> Franz Steinhäusler wrote:
>>     
>>> On Tue, 01 Apr 2008 10:19:24 -0700, Robin Dunn <robin at alldunn.com>
>>> wrote:
>>>
>>>       
>>>> Franz Steinhäusler wrote:
>>>>         
>>>>> On Tue, 25 Mar 2008 09:20:36 +0100, Franz Steinhaeusler
>>>>> <franz.steinhaeusler at gmx.at> wrote:
>>>>>
>>>>>           
>>>>>> On Sat, 22 Mar 2008 15:30:41 -0700, Robin Dunn <robin at alldunn.com>
>>>>>> wrote:
>>>>>>
>>>>>>             
>>>>>>> Franz Steinhäusler wrote:
>>>>>>>               
>>>>>> [...]
>>>>>>             
>>>>>>>> (wxgtk, unicode, gtk2, wx-assertions off, SWIG 1.3.29)
>>>>>>>>
>>>>>>>>                 
>>>>>>> Please try 2.8.7.1
>>>>>>>               
>>>>>> Thanks, I will do.
>>>>>>             
>>>>> I finally successfully compiled wxwidgets and wxpyhton from trunk
>>>>> svn, but no SetMark is working. :(
>>>>> (gtk2)
>>>>>
>>>>> Could gtk be the reason?
>>>>>           
>>>> Did you try it like I did in the screen shot where you interactively
>>>> do it from a PyShell, or did you try it in a real program?  If the
>>>> former then it may have just been a fluke of my current theme that
>>>> allowed the selection to be seen when another window had the focus.  I
>>>> wasn't expecting it to work that way.
>>>>         
>>> Strange. I tried it after your screenshot. Very good tool this
>>> inspector, anyway. I tried it also with the sample alone, with .SetMark
>>> and wx.CallAfter (SetMark, x, y). None of that things worked.
>>>
>>> Anyway, in the demo, after starting the combobox sample, the whole Text
>>> in the combobox is selected. But then, I didn't got it to show the
>>> SetMark Selection. Also I'm not 100% sure, but after call SetMark(4,7)
>>> afterwards (no selection was shown)I called GetMark and it outputs
>>> (7,7).
>>>
>>>
>>>       
>> The initial select-all when it gets the focus may be getting in your
>> way.  IIRC it happens after the EVT_SET_FOCUS event happens, so you need
>> to get a little tricky to make it work if you want to set some other
>> selection upon focus because the wx.CallAfter happens too soon.  Try
>> doing it with a short timer instead.
>>     
>
> Hello, you meant future call? Hm it doesn't work
> Here my small sample app:
>
>   

I think Robin was referring to a wx.Timer instance. You can use a timer 
to call a function every few seconds or just once after a specified 
amount of time has elapsed.

You can read up on it at the wiki: http://wiki.wxpython.org/Timer

Mike


More information about the wxpython-users mailing list