本文整理汇总了Python中wx.WHITE属性的典型用法代码示例。如果您正苦于以下问题:Python wx.WHITE属性的具体用法?Python wx.WHITE怎么用?Python wx.WHITE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.WHITE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _updateColAttrs
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WHITE [as 别名]
def _updateColAttrs(self, grid):
"""
wx.grid.Grid -> update the column attributes to add the
appropriate renderer given the column name.
Otherwise default to the default renderer.
"""
for row in range(self.GetNumberRows()):
for col in range(self.GetNumberCols()):
editor = wx.grid.GridCellTextEditor()
renderer = wx.grid.GridCellStringRenderer()
grid.SetReadOnly(row, col, self.Parent.Editable)
grid.SetCellEditor(row, col, editor)
grid.SetCellRenderer(row, col, renderer)
grid.SetCellBackgroundColour(row, col, wx.WHITE)
示例2: _updateColAttrs
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WHITE [as 别名]
def _updateColAttrs(self, grid):
"""
wx.grid.Grid -> update the column attributes to add the
appropriate renderer given the column name.
Otherwise default to the default renderer.
"""
for row in range(self.GetNumberRows()):
row_highlights = self.Highlights.get(row, {})
for col in range(self.GetNumberCols()):
colname = self.GetColLabelValue(col, False)
grid.SetReadOnly(row, col, True)
grid.SetCellEditor(row, col, None)
grid.SetCellRenderer(row, col, None)
highlight_colours = row_highlights.get(colname.lower(), [(wx.WHITE, wx.BLACK)])[-1]
grid.SetCellBackgroundColour(row, col, highlight_colours[0])
grid.SetCellTextColour(row, col, highlight_colours[1])
self.ResizeRow(grid, row)
示例3: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WHITE [as 别名]
def __init__(self, *args, **kwargs):
wx.grid.Grid.__init__(self, *args, **kwargs)
self.Editable = True
self.AddButton = None
self.DeleteButton = None
self.UpButton = None
self.DownButton = None
self.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, 'Sans'))
self.SetLabelFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, 'Sans'))
self.SetSelectionBackground(wx.WHITE)
self.SetSelectionForeground(wx.BLACK)
self.DisableDragRowSize()
self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.OnSelectCell)
self.Bind(wx.grid.EVT_GRID_EDITOR_HIDDEN, self.OnEditorHidden)
self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
示例4: _updateColAttrs
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WHITE [as 别名]
def _updateColAttrs(self, grid):
# wx.grid.Grid -> update the column attributes to add the
# appropriate renderer given the column name.
#
# Otherwise default to the default renderer.
# print "ObjectTable._updateColAttrs() called!!!"
for row in range(self.GetNumberRows()):
for col in range(self.GetNumberCols()):
PropertyName = self.BACnetObjectType.PropertyNames[col]
PropertyConfig = self.BACnetObjectType.PropertyConfig[PropertyName]
grid.SetReadOnly(row, col, False)
grid.SetCellEditor(row, col, PropertyConfig["GridCellEditor"]())
grid.SetCellRenderer(row, col, PropertyConfig["GridCellRenderer"]())
grid.SetCellBackgroundColour(row, col, wx.WHITE)
grid.SetCellTextColour(row, col, wx.BLACK)
if "GridCellEditorParam" in PropertyConfig:
grid.GetCellEditor(row, col).SetParameters(
PropertyConfig["GridCellEditorParam"])
self.ResizeRow(grid, row)
示例5: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WHITE [as 别名]
def __init__(self, parent, interpreter):
# begin wxGlade: MyFrame.__init__
wx.Panel.__init__(self, parent, -1)
self.history = []
self.index = 0
self.prompt = ">>"
self.textctrl = wx.TextCtrl(self, -1, '', style=wx.TE_PROCESS_ENTER | wx.TE_MULTILINE | wx.TE_RICH, size=(-1, 250))
self.textctrl.SetForegroundColour(wx.WHITE)
self.textctrl.SetBackgroundColour(wx.BLACK)
self.textctrl.AppendText(self.prompt)
self.textctrl.Bind(wx.EVT_CHAR, self.__bind_events)
sizer = wx.BoxSizer()
sizer.Add(self.textctrl, 1, wx.EXPAND)
self.SetSizer(sizer)
self._interp = interpreter
redir = RedirectText(self.textctrl)
import sys
# Create a replacement for stdin.
# self.reader = PseudoFileIn(self.readline, self.readlines)
# self.reader.input = ''
# self.reader.isreading = False
# sys.stdin=self.reader
sys.stdout = redir
sys.stderr = redir
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WHITE [as 别名]
def __init__(self, parent):
wxOgl.ShapeCanvas.__init__(self, parent)
self.SetDiagram(wxOgl.Diagram())
self.GetDiagram().SetCanvas(self)
self.SetBackgroundColour(wx.WHITE)
self.lastShape=None
self.Bind(wx.EVT_MOTION, self.OnMouseMove)
示例7: on_button_plot
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WHITE [as 别名]
def on_button_plot(self, event):
import numpy
xmin = xmax = step = None
try:
xmin = float( self.text_xmin.GetValue() )
self.text_xmin.SetBackgroundColour(wx.WHITE)
except:
self.text_xmin.SetBackgroundColour(wx.RED)
try:
xmax = float( self.text_max.GetValue() )
self.text_max.SetBackgroundColour(wx.WHITE)
except:
self.text_max.SetBackgroundColour(wx.RED)
try:
step = float( self.text_xstep.GetValue() )
self.text_xstep.SetBackgroundColour(wx.WHITE)
except:
self.text_xstep.SetBackgroundColour(wx.RED)
x = numpy.arange(xmin, xmax, step)
# build globals with some functions
g = {}
for name in ["sin","cos","tan","ufunc","square"]:
g[name] = getattr(numpy, name)
y = eval(self.text_function.GetValue(), g, {"numpy":numpy, "x":x})
self.matplotlib_canvas.axes.plot(x,y)
self.matplotlib_canvas.draw()
event.Skip()
示例8: on_button_plot
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WHITE [as 别名]
def on_button_plot(self, event): # wxGlade: MyFrame.<event_handler>
import numpy
xmin = xmax = step = None
try:
xmin = float( self.text_xmin.GetValue() )
self.text_xmin.SetBackgroundColour(wx.WHITE)
except:
self.text_xmin.SetBackgroundColour(wx.RED)
try:
xmax = float( self.text_max.GetValue() )
self.text_max.SetBackgroundColour(wx.WHITE)
except:
self.text_max.SetBackgroundColour(wx.RED)
try:
step = float( self.text_xstep.GetValue() )
self.text_xstep.SetBackgroundColour(wx.WHITE)
except:
self.text_xstep.SetBackgroundColour(wx.RED)
# build globals for the eval() call with some functions
g = {}
for name in ["sin","cos","tan","ufunc","square"]:
g[name] = getattr(numpy, name)
# calculate the x and y values
x = numpy.arange(xmin, xmax, step)
y = eval(self.text_function.GetValue(), g, {"numpy":numpy, "x":x})
data = numpy.stack( (x,y), 1 )
# plot them
lines = wx.lib.plot.PolyLine( data, colour=self.choice_colour.GetStringSelection() )
self.plot_datasets.append(lines)
graphics = wx.lib.plot.PlotGraphics(self.plot_datasets, "Title", "X", "Y")
self.plot_canvas.Draw(graphics)
event.Skip()
# end of class MyFrame
示例9: on_button_plot
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WHITE [as 别名]
def on_button_plot(self, event): # wxGlade: MyFrame.<event_handler>
import numpy
xmin = xmax = step = None
try:
xmin = float( self.text_xmin.GetValue() )
self.text_xmin.SetBackgroundColour(wx.WHITE)
except:
self.text_xmin.SetBackgroundColour(wx.RED)
try:
xmax = float( self.text_max.GetValue() )
self.text_max.SetBackgroundColour(wx.WHITE)
except:
self.text_max.SetBackgroundColour(wx.RED)
try:
step = float( self.text_xstep.GetValue() )
self.text_xstep.SetBackgroundColour(wx.WHITE)
except:
self.text_xstep.SetBackgroundColour(wx.RED)
x = numpy.arange(xmin, xmax, step)
# build globals with some functions
g = {}
for name in ["sin","cos","tan","ufunc","square"]:
g[name] = getattr(numpy, name)
y = eval(self.text_function.GetValue(), g, {"numpy":numpy, "x":x})
self.matplotlib_axes.plot(x,y)
self.matplotlib_canvas.draw()
event.Skip()
# end of class MyFrame
示例10: display_sys_color
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WHITE [as 别名]
def display_sys_color(self, event=None):
colour = self.sys_color.GetValue().strip()
if colour.startswith("wxSYS_COLOUR_"):
colour = getattr(wx, colour[2:], None)
else:
colour = None
if colour:
self.sys_color.SetBackgroundColour(wx.WHITE)
colour = compat.wx_SystemSettings_GetColour(colour)
else:
self.sys_color.SetBackgroundColour(wx.RED)
colour = wx.NullColour
self.sys_color_panel.SetBackgroundColour(colour)
self.sys_color_panel.Refresh()
示例11: _draw_background
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WHITE [as 别名]
def _draw_background(self, dc, clear=True):
"draw the hatches on device context dc (red if selected)"
size = self.widget.GetSize()
small = size[0]<10 or size[1]<10
focused = misc.focused_widget is self
if clear:
if small and focused:
dc.SetBackground(wx.Brush(wx.BLUE))
else:
dc.SetBackground(wx.Brush(wx.LIGHT_GREY))
dc.Clear()
if small and focused:
color = wx.WHITE
elif small or not focused:
color = wx.BLACK
else:
color = wx.BLUE
if focused:
hatch = compat.BRUSHSTYLE_CROSSDIAG_HATCH
elif not self.parent.IS_SIZER:
hatch = compat.BRUSHSTYLE_FDIAGONAL_HATCH
else:
if not "cols" in self.parent.PROPERTIES: # horizontal/vertical sizer or grid sizer?
pos = self.index
else:
pos = sum( self.sizer._get_row_col(self.index) )
hatch = compat.BRUSHSTYLE_FDIAGONAL_HATCH if pos%2 else compat.BRUSHSTYLE_BDIAGONAL_HATCH
brush = wx.Brush(color, hatch)
# draw hatched lines in foreground
dc.SetBrush(brush)
size = self.widget.GetClientSize()
dc.DrawRectangle(0, 0, size.width, size.height)
# context menu #####################################################################################################
示例12: GenerateVariablesGridBranch
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WHITE [as 别名]
def GenerateVariablesGridBranch(self, root, entries, colnames, idx=0):
item, root_cookie = self.VariablesGrid.GetFirstChild(root)
no_more_items = not item.IsOk()
for entry in entries:
idx += 1
if no_more_items:
item = self.VariablesGrid.AppendItem(root, "")
for col, colname in enumerate(colnames):
if col == 0:
self.VariablesGrid.SetItemText(item, str(idx), 0)
else:
value = entry.get(colname, "")
if colname == "Access":
value = GetAccessValue(value, entry.get("PDOMapping", ""))
self.VariablesGrid.SetItemText(item, value, col)
if entry["PDOMapping"] == "":
self.VariablesGrid.SetItemBackgroundColour(item, wx.LIGHT_GREY)
else:
self.VariablesGrid.SetItemBackgroundColour(item, wx.WHITE)
self.VariablesGrid.SetItemPyData(item, entry)
idx = self.GenerateVariablesGridBranch(item, entry["children"], colnames, idx)
if not no_more_items:
item, root_cookie = self.VariablesGrid.GetNextChild(root, root_cookie)
no_more_items = not item.IsOk()
if not no_more_items:
to_delete = []
while item.IsOk():
to_delete.append(item)
item, root_cookie = self.VariablesGrid.GetNextChild(root, root_cookie)
for item in to_delete:
self.VariablesGrid.Delete(item)
return idx
示例13: _updateColAttrs
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WHITE [as 别名]
def _updateColAttrs(self, grid):
"""
wx.grid.Grid -> update the column attributes to add the
appropriate renderer given the column name.
Otherwise default to the default renderer.
"""
for row in range(self.GetNumberRows()):
row_highlights = self.Highlights.get(row, {})
for col in range(self.GetNumberCols()):
editor = None
renderer = None
colname = self.GetColLabelValue(col, False)
if col != 0:
grid.SetReadOnly(row, col, False)
if colname == "Name":
editor = wx.grid.GridCellTextEditor()
renderer = wx.grid.GridCellStringRenderer()
elif colname == "Initial Value":
editor = wx.grid.GridCellTextEditor()
renderer = wx.grid.GridCellStringRenderer()
elif colname == "Type":
editor = wx.grid.GridCellTextEditor()
else:
grid.SetReadOnly(row, col, True)
grid.SetCellEditor(row, col, editor)
grid.SetCellRenderer(row, col, renderer)
highlight_colours = row_highlights.get(colname.lower(), [(wx.WHITE, wx.BLACK)])[-1]
grid.SetCellBackgroundColour(row, col, highlight_colours[0])
grid.SetCellTextColour(row, col, highlight_colours[1])
self.ResizeRow(grid, row)
示例14: _updateColAttrs
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WHITE [as 别名]
def _updateColAttrs(self, grid):
"""
wxGrid -> update the column attributes to add the
appropriate renderer given the column name.
Otherwise default to the default renderer.
"""
for row in range(self.GetNumberRows()):
row_highlights = self.Highlights.get(row, {})
for col in range(self.GetNumberCols()):
editor = None
renderer = None
colname = self.GetColLabelValue(col, False)
editortype = self.columnTypes.get(colname, None)
if editortype is not None:
editor = editortype(self, row, col)
grid.SetCellEditor(row, col, editor)
grid.SetCellRenderer(row, col, renderer)
highlight_colours = row_highlights.get(colname.lower(), [(wx.WHITE, wx.BLACK)])[-1]
grid.SetCellBackgroundColour(row, col, highlight_colours[0])
grid.SetCellTextColour(row, col, highlight_colours[1])
self.ResizeRow(grid, row)
示例15: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WHITE [as 别名]
def __init__(self, parent, window, items=None):
"""
Constructor
@param parent: Parent wx.Window of DebugVariableText
@param window: Reference to the Debug Variable Panel
@param items: List of DebugVariableItem displayed by Viewer
"""
DebugVariableViewer.__init__(self, window, items)
wx.Panel.__init__(self, parent)
# Set panel background colour
self.SetBackgroundColour(wx.WHITE)
# Define panel drop target
self.SetDropTarget(DebugVariableTextDropTarget(self, window))
# Bind events
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDClick)
self.Bind(wx.EVT_ENTER_WINDOW, self.OnEnter)
self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave)
self.Bind(wx.EVT_SIZE, self.OnResize)
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
self.Bind(wx.EVT_PAINT, self.OnPaint)
# Define panel min size for parent sizer layout
self.SetMinSize(wx.Size(0, 25))
# Add buttons to Viewer
for bitmap, callback in [("force", self.OnForceButton),
("release", self.OnReleaseButton),
("delete_graph", self.OnCloseButton)]:
self.Buttons.append(GraphButton(0, 0, bitmap, callback))