Details of behavior of wx.ComboBox and a little issue

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Details of behavior of wx.ComboBox and a little issue

Manuel Pérez
Hello again, i'm still trying to  learn wxPython and have another problem, i want to read the content from a combobox with wx.CB_SIMPLE style while the user is typing and meanwhile put it in the choices area, the problem is that only the first character in the box is processed and after the box deletes all it's content, so how to avoid it?.


--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Details of behavior of wx.ComboBox and a little issue

Tim Roberts
Manuel Pérez wrote:
>
> Hello again, i'm still trying to  learn wxPython and have another
> problem, i want to read the content from a combobox with wx.CB_SIMPLE
> style while the user is typing and meanwhile put it in the choices
> area, the problem is that only the first character in the box is
> processed and after the box deletes all it's content, so how to avoid it?.

Show us your code, so that we can run it here.  There are a hundred ways
you could have done this wrong.

--
Tim Roberts, [hidden email]
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Details of behavior of wx.ComboBox and a little issue

Manuel Pérez
In reply to this post by Manuel Pérez
Ok, I have  discovered how to add items using .Append(), but there is another problem, if i want to change some of them and i don´t know how to do, tried with .Clear(), but it also deletes the content in the writable area, so i thought could prevent this saving with .GetValue() the value in the ComboBox, but it turns the cursor at the beginning of the box, resulting so impractical, i want for a function to delete just the list-part of the widget, or the list or whatever where the values are to manipulate them as i need

El jueves, 12 de abril de 2018, 12:29:16 (UTC-5), Manuel Pérez escribió:
Hello again, i'm still trying to  learn wxPython and have another problem, i want to read the content from a combobox with wx.CB_SIMPLE style while the user is typing and meanwhile put it in the choices area, the problem is that only the first character in the box is processed and after the box deletes all it's content, so how to avoid it?.


G
M
T






Text-to-speech function is limited to 200 characters

Options : History : Feedback : <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=GD9D8CPW8HFA2" title="Make a small contribution" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.paypal.com%2Fcgi-bin%2Fwebscr%3Fcmd%3D_s-xclick%26hosted_button_id%3DGD9D8CPW8HFA2\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEW5XYk2eJQM5gPrcRa8nFVvyfHtg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.paypal.com%2Fcgi-bin%2Fwebscr%3Fcmd%3D_s-xclick%26hosted_button_id%3DGD9D8CPW8HFA2\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEW5XYk2eJQM5gPrcRa8nFVvyfHtg&#39;;return true;">DonateClose

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Details of behavior of wx.ComboBox and a little issue

Manuel Pérez
In reply to this post by Manuel Pérez
and the code, sorry for the syntax, i'm lazy
#-*- coding: utf-8 -*-
from wx import *
class Search(Frame):
def __init__(self):
Frame.__init__(self, None, title = "busqueda1")
self.Show()
self.initWidgets()
self.initBindings()
self.current = "" #neede for search


def initWidgets(self):
self.chc = []#["1","2","3"]
self.searchon = ["Maria", "Pablo", "casa", "oro"]
self.combo = ComboBox(self, -1, choices = self.chc, style = CB_SIMPLE, pos = (100,30), size = (150,50))

def initBindings(self):
self.combo.Bind(EVT_TEXT, self.OnSearchF)

def OnSearchF(self, event):
while len(self.chc) > 0:
self.chc.remove(self.chc[0])
idx = None
look = self.combo.GetValue() + self.current
for entire in self.searchon:
for every in entire:
if len(look) > 0:
if look[0] == every: #la primer letra de lo escrito en buscando coincide con alguno
idx = entire.index(look[0])
equal = True
if idx != None:
if len(entire) >= (idx + len(look)):
for IsEqual in look:
if entire[idx] != IsEqual:
equal = False
idx += 1
if equal == True:
self.chc.append(entire)
idx = None

#########essentially that is the part that don't know; i added the items to the list-part of the combobox, but for delete only them...
#self.combo.Clear()
for toapp in self.chc: #
#print toapp
self.combo.Append(toapp)



if __name__=='__main__':
app = App()
frame = Search()
app.MainLoop()


El jueves, 12 de abril de 2018, 12:29:16 (UTC-5), Manuel Pérez escribió:
Hello again, i'm still trying to  learn wxPython and have another problem, i want to read the content from a combobox with wx.CB_SIMPLE style while the user is typing and meanwhile put it in the choices area, the problem is that only the first character in the box is processed and after the box deletes all it's content, so how to avoid it?.


G
M
T






Text-to-speech function is limited to 200 characters

Options : History : Feedback : <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=GD9D8CPW8HFA2" title="Make a small contribution" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.paypal.com%2Fcgi-bin%2Fwebscr%3Fcmd%3D_s-xclick%26hosted_button_id%3DGD9D8CPW8HFA2\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEW5XYk2eJQM5gPrcRa8nFVvyfHtg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.paypal.com%2Fcgi-bin%2Fwebscr%3Fcmd%3D_s-xclick%26hosted_button_id%3DGD9D8CPW8HFA2\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEW5XYk2eJQM5gPrcRa8nFVvyfHtg&#39;;return true;">DonateClose

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Details of behavior of wx.ComboBox and a little issue

Dietmar Schwertberger-2
I'm not sure, but maybe wx.lib.TextCtrlAutoComplete matches your use case.
I'm using that one in some of my dialogs and it works quite well.


Regards,

Dietmar

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Details of behavior of wx.ComboBox and a little issue

Robin Dunn
In reply to this post by Manuel Pérez

On Thursday, April 12, 2018 at 12:55:52 PM UTC-7, Manuel Pérez wrote:
 
#########essentially that is the part that don't know; i added the items to the list-part of the combobox, but for delete only them... 
#self.combo.Clear()
for toapp in self.chc: #
#print toapp
self.combo.Append(toapp)


Give the Set(items) method inherited from wx.ItemContainer.  IIRC it should allow you to replace just the items in the popup list.

--
Robin
G
M
T






Text-to-speech function is limited to 200 characters

Options : History : Feedback : <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=GD9D8CPW8HFA2" title="Make a small contribution" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.paypal.com%2Fcgi-bin%2Fwebscr%3Fcmd%3D_s-xclick%26hosted_button_id%3DGD9D8CPW8HFA2\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEW5XYk2eJQM5gPrcRa8nFVvyfHtg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.paypal.com%2Fcgi-bin%2Fwebscr%3Fcmd%3D_s-xclick%26hosted_button_id%3DGD9D8CPW8HFA2\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEW5XYk2eJQM5gPrcRa8nFVvyfHtg&#39;;return true;">DonateClose

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.