Is there some place where I can get a list of the "named" colors (i.e., goldenrod) available in wxpython? I'm using osx 10.6.8. Thank you.
Here you go:
''' wx_colourdb_show1.py show the colours in wxPython's wx.lib.colourdb the database has 630 named colors use wx.lib.scrolledpanel.ScrolledPanel and wx.GridSizer to show the colours and their names Python 2.7.5 ''' import wx import wx.lib.scrolledpanel # note the goofy english spelling import wx.lib.colourdb class MyScrolledPanel(wx.lib.scrolledpanel.ScrolledPanel): def __init__(self, parent): # make the scrolled panel larger than its parent wx.lib.scrolledpanel.ScrolledPanel.__init__(self, parent, wx.ID_ANY, size=(600, 450), style=wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER) # scroll bars won't appear until required # default is SetupScrolling(scroll_x=True, scroll_y=True) self.SetupScrolling() self.SetBackgroundColour("white") wx.lib.colourdb.updateColourDB() # create a list of all the colours in the colour data base #colours = wx.lib.colourdb.getColourList() colours = wx.lib.colourdb.getColourInfoList() # main sizer vsizer = wx.BoxSizer(wx.VERTICAL) # wx.GridSizer(rows, cols, vgap, hgap) gsizer = wx.GridSizer(len(colours), 3, 2, 2) n = 1 for line in colours: #print line, # eg. line = ('SNOW', 255, 250, 250) hexstr = "#%02X%02X%02X" % tuple(line[1:]) s = "%3d %s" % (n, line) t = wx.StaticText(self, wx.ID_ANY, s) gsizer.Add(t, 0, wx.ALL, border=2) t = wx.StaticText(self, wx.ID_ANY, hexstr) gsizer.Add(t, 0, wx.ALL, border=2) p = wx.Panel(self, wx.ID_ANY) p.SetBackgroundColour(hexstr) gsizer.Add(p, 0, wx.ALL|wx.EXPAND, border=2) n += 1 # now add the whole thing to the main sizer and set it vsizer.Add(gsizer, 0, wx.ALL|wx.EXPAND, 10) self.SetSizer(vsizer) app = wx.App(0) # create a frame, no parent, default ID, title, size caption = "all the colours in wx.lib.colourdb" frame = wx.Frame(None, wx.ID_ANY, caption, size=(600, 450)) MyScrolledPanel(frame) frame.Show(True) app.MainLoop()
This is wonderful. Thank you so much. I think others will also find this useful.
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.
Private Sub btn_addline_Click(ByVal ...
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...
OK, so HostGator for some reason no longer allows gcc/g++ access unless you have a Designated Server account, which is a lot of money to spend just to compile my "Hello World" program. Thus I figured I'd compile at home, then upload. Program is your regular old bare-bones Hello World ...