Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use named colors in wxpython?

I get named colours in wx this way:

import wx.lib.colourdb as wb
wb.getColourList()

Although "ORANGE" is in wx.lib.colourdb, i cannot set a grid cell's color to wx.ORANGE because it says:

AttributeError: 'module' object has no attribute 'ORANGE'

How do I use the colors defined in wx.lib.colourdb.getColourList() ?

like image 291
alwbtc Avatar asked Sep 12 '13 18:09

alwbtc


1 Answers

color = wx.NamedColour("orange")

some_window.SetForegroundColour("orange") 

(make sure you start your app first)

in order to load some of the colours into wx.TheColourDatabase you will need to run

wx.lib.colourdb.updateColourDB()  #adds ALOT more named colours to wx.TheColourDatabase
c1 = wx.NamedColour("light coral")
c2 = wx.NamedColour("peachpuff2")
like image 76
Joran Beasley Avatar answered Sep 28 '22 19:09

Joran Beasley