Combobox / placeholder, helper ,or default value among a list

1,461 views
Skip to first unread message

chris tophe

unread,
Jul 30, 2019, 2:48:11 AM7/30/19
to wxPython-users
Hi,

i have a list carList = ["ferrari","porsche","tesla","dolorean"]
and a combobox comboCar = wx.ComboBox(self.panel1, pos=(400, 100), choices=carList, style=wx.CB_READONLY)

1-i have a blank in the combobox before selecting,  where i would like to have written inside "select car" (instead of adding a statictext uppon it) ie a placeholder

2-if i want a defaut choice as dolorean ?.

3-if i just want a helper without placeholder nor default choice ?



Tim Roberts

unread,
Jul 30, 2019, 12:36:55 PM7/30/19
to wxpytho...@googlegroups.com
chris tophe wrote:
>
> i have a list carList = ["ferrari","porsche","tesla","dolorean"]
> and a combobox comboCar = wx.ComboBox(self.panel1, pos=(400, 100),
> choices=carList, style=wx.CB_READONLY)
>
> 1-i have a blank in the combobox before selecting,  where i would like
> to have written inside "select car" (instead of adding a statictext
> uppon it) ie a placeholder

Make your list ["--Select car--", "Ferrari", "Porsche", "Tesla",
"Delorean"].  You can check in the click handler that they don't choose
"--Select car--".


> 2-if i want a defaut choice as dolorean ?.

You can't have a "select car" option along with a default choice.  It
doesn't make sense.  What would the user experience be here?


> 3-if i just want a helper without placeholder nor default choice ?

This question doesn't make sense to me, either.  Perhaps you should
sketch something in a drawing app to show us what you are picturing.

--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.


chris tophe

unread,
Aug 6, 2019, 5:17:31 PM8/6/19
to wxpytho...@googlegroups.com
thx !

--
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/04898994-000e-acea-1da1-dbab3bef49b7%40probo.com.
Reply all
Reply to author
Forward
0 new messages