Font for select -Combo

Asked by Jeff_Vallis

User Interactions

https://sikulix-2014.readthedocs.io/en/latest/interaction.html

I am using the Combo Box - select command

Can I set the font for the data I am displaying to a fixed width font to make it easier to read.

The Data is a bit like a table of items

Item 1 Desc Quan
Item 1 Desc Quan
etc

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#2

sorry, bullshit :-(

currently you use something like this:

items = ("item1 hello 666", "item2 hello 111" , "item3 hello 999")

select("select sthg", "my selection", items)

try this:

newItems = ["<html><font face='monospaced'>" + item for item in items]
select("select sthg", "my selection", newItems)

You might even play with the fontsize:
newItems = ["<html><font face='monospaced' size=5>" + item for item in items]

Revision history for this message
Jeff_Vallis (vallis-pj) said :
#3

Nearly there It doesn't deal with spaces as I expected -
Example

items = []
items.append("{ 1490} My_Actions >> Connection Error")
items.append("{ 180} My_Actions Type Login")
items.append("{ 287} My_Instructions >> Test Bank Reload if Failed")
items.append("{ 280} My_Actions Bank")
items.append("{ 1930} My_Actions Set Focus Location Top Left")
items.append("{ 149} My_Instructions Login")
items.append("{ 219} My_Actions Close All")
items.append("{ 3241} My_Actions Image List to Close")
items.append("{ 149} My_Instructions Login")
items.append("{ 1930} My_Actions Set Focus Location Top Left")
items.append("{ 490} My_Actions > System Maintenace Reward")
items.append("{ 494} My_Actions >> System Maintenace Reward Claim")
items.append("{ 2084} My_Actions Reward for Waiting")
items.append("{ 2085} My_Actions Reward for Waiting Claim")
items.append("{ 275} My_Actions Screen Reset Hover and Scroll")

newItems = ["<html><font face='monospaced'>" + item for item in items]
select("select sthg", "my selection", newItems)

items2 = []
for i in range(len(items)):
    items2.append(items[i].replace(" ","_"))

newItems = ["<html><font face='monospaced'>" + item for item in items2]
select("select sthg", "my selection", newItems)

Revision history for this message
Best RaiMan (raimund-hocke) said :
#4

ok, that is HTML behaviour: multiple blanks are collapsed to one blank.
Sorry, did not realise it.

so:
newItems = ["<html><font face='monospaced'>" + item.replace(" ", "&nbsp;") for item in items]

the HTML-constant &nbsp; will be respected and finally result in a blank.

Revision history for this message
Jeff_Vallis (vallis-pj) said :
#5

Great and I was trying to replace the spaces with Unicode - going in the wrong direction again

Thank
Jeff