当前位置: 首页>>代码示例>>Python>>正文


Python wx.Colour方法代码示例

本文整理汇总了Python中wx.Colour方法的典型用法代码示例。如果您正苦于以下问题:Python wx.Colour方法的具体用法?Python wx.Colour怎么用?Python wx.Colour使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wx的用法示例。


在下文中一共展示了wx.Colour方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: updateConnectStatus

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Colour [as 别名]
def updateConnectStatus( self, color='black' ):
        self.connectStatusColor = color
        if color == 'black':
            self.m_button_allInOneAction.SetLabel(uilang.kMainLanguageContentDict['button_allInOneAction_black'][self.languageIndex])
            self.m_button_allInOneAction.SetBackgroundColour( wx.Colour( 0x80, 0x80, 0x80 ) )
        elif color == 'yellow':
            self.m_button_allInOneAction.SetLabel(uilang.kMainLanguageContentDict['button_allInOneAction_yellow'][self.languageIndex])
            self.m_button_allInOneAction.SetBackgroundColour( wx.Colour( 0xff, 0xff, 0x80 ) )
        elif color == 'green':
            self.m_button_allInOneAction.SetLabel(uilang.kMainLanguageContentDict['button_allInOneAction_green'][self.languageIndex])
            self.m_button_allInOneAction.SetBackgroundColour( wx.Colour( 0x80, 0xff, 0x80 ) )
        elif color == 'blue':
            self.m_button_allInOneAction.SetLabel(uilang.kMainLanguageContentDict['button_allInOneAction_blue'][self.languageIndex])
            self.m_button_allInOneAction.SetBackgroundColour( wx.Colour( 0x00, 0x80, 0xff ) )
        elif color == 'red':
            self.m_button_allInOneAction.SetLabel(uilang.kMainLanguageContentDict['button_allInOneAction_red'][self.languageIndex])
            self.m_button_allInOneAction.SetBackgroundColour( wx.Colour( 0xff, 0x80, 0x80 ) )
        else:
            pass 
开发者ID:JayHeng,项目名称:NXP-MCUBootFlasher,代码行数:21,代码来源:uicore.py

示例2: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Colour [as 别名]
def __init__(self, parent, id=-1, colour=wx.BLACK,
                         pos=wx.DefaultPosition, size=wx.DefaultSize,
                         style = CLRP_DEFAULT_STYLE,
                         validator = wx.DefaultValidator,
                         name = "colourpickerwidget"):
                
                wx.BitmapButton.__init__(self, parent, id, wx.Bitmap(1,1), 
                                         pos, size, style, validator, name)
                self.SetColour(colour)
                self.InvalidateBestSize()
                self.SetInitialSize(size)
                self.Bind(wx.EVT_BUTTON, self.OnButtonClick)
                
                global _colourData
                if _colourData is None:
                    _colourData = wx.ColourData()
                    _colourData.SetChooseFull(True)
                    grey = 0
                    for i in range(16):
                        c = wx.Colour(grey, grey, grey)
                        _colourData.SetCustomColour(i, c)
                        grey += 16 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:24,代码来源:core.py

示例3: draw_background

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Colour [as 别名]
def draw_background(self):
        """
        Draw the background box.

        If I don't do this, then the background is black.

        Could I change wx.EmptyBitmap() so that it defaults to white rather
        than black?
        """
        # TODO: change the bitmap background to be transparent
        c = wx.Colour(200, 230, 230, 0)
        c = wx.Colour(255, 255, 255, 0)
        pen = wx.Pen(c)
        brush = wx.Brush(c)
        self.mdc.SetPen(pen)
        self.mdc.SetBrush(brush)
        self.mdc.DrawRectangle(0, 0, self.dc_w, self.dc_h) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:19,代码来源:wm_legend.py

示例4: on_change_high_color

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Colour [as 别名]
def on_change_high_color(self, event):
        """Change the high color and refresh display."""
        print("High color menu item clicked!")
        cd = wx.ColourDialog(self)
        cd.GetColourData().SetChooseFull(True)

        if cd.ShowModal() == wx.ID_OK:
            new_color = cd.GetColourData().Colour
            print("The color {} was chosen!".format(new_color))
            self.panel.on_color_change({'high': new_color, 'low': None})
            self.panel.Refresh()
        else:
            print("no color chosen :-(")
        cd.Destroy()

    # TODO: See the 'and' in the docstring? Means I need a separate method! 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:18,代码来源:wm_frame.py

示例5: get_wxcolour

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Colour [as 别名]
def get_wxcolour(self, color):
        """return a wx.Colour from RGB format"""
        DEBUG_MSG("get_wx_color()", 1, self)
        if len(color) == 3:
            r, g, b = color
            r *= 255
            g *= 255
            b *= 255
            return wx.Colour(red=int(r), green=int(g), blue=int(b))
        else:
            r, g, b, a = color
            r *= 255
            g *= 255
            b *= 255
            a *= 255
            return wx.Colour(red=int(r), green=int(g), blue=int(b), alpha=int(a)) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:18,代码来源:backend_wx.py

示例6: get_wxcolour

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Colour [as 别名]
def get_wxcolour(self, color):
        """return a wx.Colour from RGB format"""
        DEBUG_MSG("get_wx_color()", 1, self)
        if len(color) == 3:
            r, g, b = color
            r *= 255
            g *= 255
            b *= 255
            return wx.Colour(red=int(r), green=int(g), blue=int(b))
        else:
            r, g, b, a = color
            r *= 255
            g *= 255
            b *= 255
            a *= 255
            return wx.Colour(
                red=int(r),
                green=int(g),
                blue=int(b),
                alpha=int(a)) 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:22,代码来源:backend_wx.py

示例7: draw_monitor_numbers

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Colour [as 别名]
def draw_monitor_numbers(self, use_ppi_px):
        font = wx.Font(24, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
        font_clr = wx.Colour(60, 60, 60, alpha=wx.ALPHA_OPAQUE)

        for st_bmp in self.preview_img_list:
            bmp = st_bmp.GetBitmap()
            dc = wx.MemoryDC(bmp)
            text = str(self.preview_img_list.index(st_bmp))
            dc.SetTextForeground(font_clr)
            dc.SetFont(font)
            dc.DrawText(text, 5, 5)
            del dc
            st_bmp.SetBitmap(bmp)

        if use_ppi_px:
            self.draw_monitor_sizes() 
开发者ID:hhannine,项目名称:superpaper,代码行数:18,代码来源:gui.py

示例8: draw_monitor_sizes

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Colour [as 别名]
def draw_monitor_sizes(self):
        font = wx.Font(24, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_LIGHT)
        font_clr = wx.Colour(60, 60, 60, alpha=wx.ALPHA_OPAQUE)

        for st_bmp, img_sz, dsp in zip(self.preview_img_list,
                                       self.img_rel_sizes,
                                       self.display_sys.disp_list):
            bmp = st_bmp.GetBitmap()
            dc = wx.MemoryDC(bmp)
            text = str(dsp.diagonal_size()[1]) + '"'
            dc.SetTextForeground(font_clr)
            dc.SetFont(font)
            # bmp_w, bmp_h = dc.GetSize()
            bmp_w, bmp_h = img_sz
            text_w, text_h = dc.GetTextExtent(text)
            pos_w = bmp_w - text_w - 5
            pos_h = 5
            dc.DrawText(text, pos_w, pos_h)
            del dc
            st_bmp.SetBitmap(bmp) 
开发者ID:hhannine,项目名称:superpaper,代码行数:22,代码来源:gui.py

示例9: background_color

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Colour [as 别名]
def background_color(self, node, depth):
        """Create a (unique-ish) background color for each node"""
        if self.color_mapping is None:
            self.color_mapping = {}
        if node['type'] == 'type':
            key = node['name']
        else:
            key = node['type']
        color = self.color_mapping.get(key)
        if color is None:
            depth = len(self.color_mapping)
            red = (depth * 10) % 255
            green = 200 - ((depth * 5) % 200)
            blue = (depth * 25) % 200
            self.color_mapping[key] = color = wx.Colour(red, green, blue)
        return color 
开发者ID:lrq3000,项目名称:pyFileFixity,代码行数:18,代码来源:meliaeadapter.py

示例10: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Colour [as 别名]
def __init__(self):
        super().__init__(parent=None,
                         title='Sample App',
                         size=(300, 300))

        # Set up the first Panel to be at position 1, 1
        # and of size 300 by 100 with a blue background
        self.panel1 = wx.Panel(self)
        self.panel1.SetSize(300, 100)
        self.panel1.SetBackgroundColour(wx.Colour(0, 0, 255))

        # Set up the second Panel to be at position 1, 110
        # and of size 300 by 100 with a red background
        self.panel2 = wx.Panel(self)
        self.panel2.SetSize(1, 110, 300, 100)
        self.panel2.SetBackgroundColour(wx.Colour(255, 0, 0)) 
开发者ID:johnehunt,项目名称:advancedpython3,代码行数:18,代码来源:FrameAndPanelApp.py

示例11: updateStocks

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Colour [as 别名]
def updateStocks (self):
		self.m_productsGrid.DeleteRows(numRows=self.m_productsGrid.GetNumberRows())
		
		p = self.populateTable()
		lenP = len(p)
		
		self.m_productsGrid.InsertRows(numRows=lenP)

		# Populate Table
		row = 0
		for x in p:
			col = 0
			x = list(x.values())

			if float(x[5]) > float(x[6]):
				self.m_productsGrid.SetCellBackgroundColour(row, 6, wx.Colour(255, 128, 128))
			for y in x:
				self.m_productsGrid.SetCellValue(row, col, str(y))
				col = col + 1
			row = row + 1 
开发者ID:104H,项目名称:HH---POS-Accounting-and-ERP-Software,代码行数:22,代码来源:stockLevelsPanel.py

示例12: updateQuotes

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Colour [as 别名]
def updateQuotes (self):
		self.m_quoteInfoGrid.DeleteRows(numRows=self.m_quoteInfoGrid.GetNumberRows())
		
		p = self.populateTable()
		lenP = len(p)
		
		self.m_quoteInfoGrid.InsertRows(numRows=lenP)
		
		# Populate Table
		col=0
		for x in p:
			row=0
			x = list(x.values())
			#if float(x[3]) > float(x[4]):
				#print((x, row))
				#self.m_quoteInfoGrid.SetCellBackgroundColour(x[0], 4, wx.Colour(255, 128, 128))
			for y in x:
				self.m_quoteInfoGrid.SetCellValue(col, row, str(y))
				row = row+1
			col = col+1 
开发者ID:104H,项目名称:HH---POS-Accounting-and-ERP-Software,代码行数:22,代码来源:quoteInfoPanel.py

示例13: updatePurchases

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Colour [as 别名]
def updatePurchases (self):
		self.m_purchaseGrid.DeleteRows(numRows=self.m_purchaseGrid.GetNumberRows())
		
		p = self.populateTable()
		lenP = len(p)
		
		self.m_purchaseGrid.InsertRows(numRows=lenP)
		
		# Populate Table
		row=0
		for x in p:
			col=0
			x = list(x.values())
			if x[2] > x[3]:
				self.m_purchaseGrid.SetCellBackgroundColour(row, 3, wx.Colour(255, 128, 128))
			for y in x:
				self.m_purchaseGrid.SetCellValue(row, col, str(y))
				col = col+1
			row = row+1 
开发者ID:104H,项目名称:HH---POS-Accounting-and-ERP-Software,代码行数:21,代码来源:purchaseInfoPanel.py

示例14: updateInvoices

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Colour [as 别名]
def updateInvoices (self):
		if self.m_invoiceGrid.GetNumberRows() > 0:
			self.m_invoiceGrid.DeleteRows(numRows=self.m_invoiceGrid.GetNumberRows())
		
		p = self.populateTable()
		lenP = len(p)
		
		self.m_invoiceGrid.InsertRows(numRows=lenP)
		
		# Populate Table
		row=0
		for x in p:
			col=0
			x = list(x.values())
			if float(x[3]) > float(x[4]):
				self.m_invoiceGrid.SetCellBackgroundColour(row, 4, wx.Colour(255, 128, 128))
			for y in x:
				self.m_invoiceGrid.SetCellValue(row, col, str(y))
				col = col+1
			row = row+1
        # 
开发者ID:104H,项目名称:HH---POS-Accounting-and-ERP-Software,代码行数:23,代码来源:invoiceInfoPanel.py

示例15: updatePurchases

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Colour [as 别名]
def updatePurchases (self):
		self.m_purchaseGrid.DeleteRows(numRows=self.m_purchaseGrid.GetNumberRows())
		
		p = self.populateTable()
		lenP = len(p)
		
		self.m_purchaseGrid.InsertRows(numRows=lenP)
		
		# Populate Table
		col=0
		for x in p:
			row=0
			x = list(x.values())
			if x[3] > x[4]:
				self.m_purchaseGrid.SetCellBackgroundColour(row, 4, wx.Colour(255, 128, 128))
			for y in x:
				self.m_purchaseGrid.SetCellValue(col, row, str(y))
				row = row+1
			col = col+1 
开发者ID:104H,项目名称:HH---POS-Accounting-and-ERP-Software,代码行数:21,代码来源:purchaseInfoPanel.py


注:本文中的wx.Colour方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。