def OnInsert(self, event): if not self.checkBox1.GetValue(): self.backgroundColour = wx.Colour(255, 255, 255) label = self.textCtrl1.GetValue() separator='#---%s---%s%s%s'%(\ label, wxColour2html(self.foregroundColour), wxColour2html(self.backgroundColour), sm.zfill('-',(59-len(label))).replace('0','-')) self.GetParent().source.ReplaceSelection(separator) self.Close()
def OnInsert(self, event): if not self.checkBox1.GetValue(): self.backgroundColour = wx.Colour(255, 255, 255) label = self.textCtrl1.GetValue() separator = "#---%s---%s%s%s" % ( label, wxColour2html(self.foregroundColour), wxColour2html(self.backgroundColour), sm.zfill("-", (59 - len(label))).replace("0", "-"), ) self.GetParent().source.ReplaceSelection(separator) self.Close()
def wxColour2html(c): return ('#%s%s%s' % tuple(map(lambda x: sm.zfill(hex(x)[2:], 2), c.Get()))).upper()
def wxColour2html(c): return ("#%s%s%s" % tuple(map(lambda x: sm.zfill(hex(x)[2:], 2), c.Get()))).upper()