本文整理汇总了Python中wx.EVT_SLIDER属性的典型用法代码示例。如果您正苦于以下问题:Python wx.EVT_SLIDER属性的具体用法?Python wx.EVT_SLIDER怎么用?Python wx.EVT_SLIDER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.EVT_SLIDER属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SLIDER [as 别名]
def __init__(self, parent, label, param):
self.sliderLabel = wx.StaticText(parent, label=label)
self.sliderText = wx.TextCtrl(parent, -1, style=wx.TE_PROCESS_ENTER)
self.slider = wx.Slider(parent, -1)
# self.slider.SetMax(param.maximum*1000)
self.slider.SetRange(0, param.maximum * 1000)
self.setKnob(param.value)
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(self.sliderLabel, 0,
wx.EXPAND | wx.ALIGN_CENTER | wx.ALL,
border=2)
sizer.Add(self.sliderText, 0,
wx.EXPAND | wx.ALIGN_CENTER | wx.ALL,
border=2)
sizer.Add(self.slider, 1, wx.EXPAND)
self.sizer = sizer
self.slider.Bind(wx.EVT_SLIDER, self.sliderHandler)
self.sliderText.Bind(wx.EVT_TEXT_ENTER, self.sliderTextHandler)
self.param = param
self.param.attach(self)
示例2: OnChooseImage
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SLIDER [as 别名]
def OnChooseImage(self, event):
# Whilst scrolling and choosing, show what we are looking at
selected_image = self.images[self.image_chooser_panel.GetValue() - 1]
# Always show the current 'loaded' image as such
if selected_image == self.images.selected:
self.image_chooser_panel.set_label(self.get_key(selected_image))
else:
self.image_chooser_panel.set_temporary_label(self.get_key(selected_image))
# Don't update whilst dragging the slider
if event.EventType == wx.EVT_SLIDER.typeId:
if (
wx.GetMouseState().LeftDown()
if WX3
else wx.GetMouseState().LeftIsDown()
):
return
# Once we've stopped scrolling, load the selected item
self.load_image(selected_image)
示例3: OnUpdateBrightness
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SLIDER [as 别名]
def OnUpdateBrightness(self, event):
"""Handle updates from the brightness-related controls"""
# Don't update whilst dragging the slider
if event.GetEventType() == wx.EVT_SLIDER.typeId:
if wx.GetMouseState().LeftIsDown():
return
# For e.g. IntCtrl check the value is valid
if hasattr(event.EventObject, "IsInBounds"):
if not event.EventObject.IsInBounds():
return
# Read the new value then update everything if we need to
if self.settings.brightness != event.EventObject.GetValue():
self.settings.brightness = event.EventObject.GetValue()
self.OnUpdate(event)
示例4: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SLIDER [as 别名]
def __init__(self, parent, label, key, settings_window, speed_classes):
self.key = key
self.settings_window = settings_window
wx.StaticBox.__init__(self, parent, label=label)
self.sizer = wx.StaticBoxSizer(self, wx.VERTICAL)
self.text = ElectroStaticText(parent, wx.ID_ANY, 'text')
self.setfunc = lambda v : self.settings_window.setfunc(key, v)
self.slider = RateSlider(parent, self.settings_window.config[key], speed_classes)
self.slider.Bind(wx.EVT_SLIDER, self.OnSlider)
self.LoadValue()
self.sizer.Add(self.text, proportion=1, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT, border=SPACING)
self.sizer.Add(self.slider, proportion=1, flag=wx.GROW|wx.BOTTOM|wx.LEFT|wx.RIGHT, border=SPACING)
示例5: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SLIDER [as 别名]
def __init__(self, parent):
wx.MiniFrame.__init__(
self,
parent,
-1,
title="OpenGL settings",
pos=(100, 100),
style=wx.CAPTION | wx.CLOSE_BOX | wx.RAISED_BORDER,
)
self.parent = parent
self.widgets = {}
panel = wx.Panel(self, -1)
main_sizer = wx.BoxSizer(wx.VERTICAL)
fog_box = wx.CheckBox(panel, -1, "Use fog")
fog_box.SetValue(parent.flag_show_fog)
main_sizer.Add(fog_box, 0, wx.ALL, 5)
self.fog_box = fog_box
szr = wx.FlexGridSizer(rows=0, cols=2, vgap=5, hgap=5)
main_sizer.Add(szr, 0, 0, 0)
slab_label = wx.StaticText(panel, -1, "Slab:")
slab_slider = wx.Slider(
panel, -1, int(parent.slab_scale * 100), minValue=1, maxValue=100
)
szr.Add(slab_label, 0, wx.ALL, 5)
szr.Add(slab_slider, 0, wx.ALL, 5)
fog_label = wx.StaticText(panel, -1, "Fog scale:")
fog_slider = wx.Slider(
panel, -1, int(parent.fog_scale_factor * 100), minValue=1, maxValue=100
)
szr.Add(fog_label, 0, wx.ALL, 5)
szr.Add(fog_slider, 0, wx.ALL, 5)
self.widgets["slab_scale"] = slab_slider
self.widgets["fog_scale_factor"] = fog_slider
self.SetSizer(main_sizer)
main_sizer.Fit(panel)
self.Fit()
self.Bind(wx.EVT_SLIDER, self.OnUpdate)
self.Bind(wx.EVT_CHECKBOX, self.OnUpdate)
self.Bind(wx.EVT_CLOSE, self.OnClose)
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SLIDER [as 别名]
def __init__(self, parent, eventHandler):
Monitor.__init__(self, None, False, False, None, None, False, [], [])
self._eventHandler = eventHandler
self._isRecording = False
self._isRunning = False
self._isLow = True
self._colours = []
pre = wx.PrePanel()
self._ui = load_ui('PanelMonitor.xrc')
handlerNumCtrl = XrcHandlerNumCtrl()
handlerMeter = XrcHandlerMeter()
self._ui.AddHandler(handlerNumCtrl)
self._ui.AddHandler(handlerMeter)
self._ui.LoadOnPanel(pre, parent, 'PanelMonitor')
self.PostCreate(pre)
self._panelColour = xrc.XRCCTRL(pre, 'panelColour')
self._checkEnable = xrc.XRCCTRL(pre, 'checkEnable')
self._checkAlert = xrc.XRCCTRL(pre, 'checkAlert')
self._checkDynamic = xrc.XRCCTRL(pre, 'checkDynamic')
self._choiceFreq = xrc.XRCCTRL(pre, 'choiceFreq')
self._textSignals = xrc.XRCCTRL(pre, 'textSignals')
# TODO: hackish
for child in self.GetChildren():
if isinstance(child, WidgetMeter):
self._meterLevel = child
self._sliderThreshold = xrc.XRCCTRL(pre, 'sliderThreshold')
self._buttonDel = xrc.XRCCTRL(pre, 'buttonDel')
self.__set_records()
self._on_del = None
self._panelColour.Bind(wx.EVT_LEFT_UP, self.__on_colour)
self.Bind(wx.EVT_CHECKBOX, self.__on_enable, self._checkEnable)
self.Bind(wx.EVT_CHECKBOX, self.__on_alert, self._checkAlert)
self.Bind(wx.EVT_CHECKBOX, self.__on_dynamic, self._checkDynamic)
self.Bind(wx.EVT_CHOICE, self.__on_freq, self._choiceFreq)
self.Bind(wx.EVT_SLIDER, self.__on_threshold, self._sliderThreshold)
self.Bind(wx.EVT_BUTTON, self.__on_del, self._buttonDel)
示例7: select_individual
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SLIDER [as 别名]
def select_individual(self, event):
individualName = self.individualrdb.GetStringSelection()
self.change_marker_size.Hide()
self.change_marker_size.Destroy()
if individualName == "single":
self.checkBox.Hide()
self.individualrdb.Hide()
self.rdb.Hide()
(
self.choiceBox,
self.individualrdb,
self.rdb,
self.change_marker_size,
self.checkBox,
) = self.choice_panel.addRadioButtons(
self.uniquebodyparts, self.individual_names, self.file, self.markerSize
)
self.individualrdb.SetStringSelection(individualName)
self.individualrdb.Bind(wx.EVT_RADIOBOX, self.select_individual)
self.figure.delaxes(self.figure.axes[1])
self.image_panel.addcolorbar(
self.img,
self.image_axis,
self.iter,
self.uniquebodyparts,
self.colormap,
)
self.checkBox.Bind(wx.EVT_CHECKBOX, self.activateSlider)
self.change_marker_size.Bind(wx.EVT_SLIDER, self.OnSliderScroll)
else:
self.checkBox.Hide()
self.individualrdb.Hide()
self.rdb.Hide()
(
self.choiceBox,
self.individualrdb,
self.rdb,
self.change_marker_size,
self.checkBox,
) = self.choice_panel.addRadioButtons(
self.multibodyparts, self.individual_names, self.file, self.markerSize
)
self.individualrdb.SetStringSelection(individualName)
self.change_marker_size.Show()
self.checkBox.Show()
self.individualrdb.Show()
self.rdb.Show()
self.individualrdb.Bind(wx.EVT_RADIOBOX, self.select_individual)
self.figure.delaxes(self.figure.axes[1])
self.image_panel.addcolorbar(
self.img, self.image_axis, self.iter, self.multibodyparts, self.colormap
)
self.checkBox.Bind(wx.EVT_CHECKBOX, self.activateSlider)
self.change_marker_size.Bind(wx.EVT_SLIDER, self.OnSliderScroll)
示例8: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SLIDER [as 别名]
def __init__(self, *args, **kwds):
wx.Panel.__init__(self, *args, **kwds)
self.settings = self.GetParent().settings
self._sizer = wx.BoxSizer(wx.VERTICAL)
s = self._sizer
self.SetSizer(self._sizer)
grid = wx.FlexGridSizer(cols=2, rows=2)
s.Add(grid)
txt1 = wx.StaticText(self, -1, "Zoom level:")
grid.Add(txt1, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
self.zoom_ctrl = wx.Choice(
self, -1, choices=["Auto", "25%", "50%", "100%", "200%", "400%", "800%"]
)
self.zoom_ctrl.SetSelection(self.settings.zoom_level)
grid.Add(self.zoom_ctrl, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
txt11 = wx.StaticText(self, -1, "Color scheme:")
grid.Add(txt11, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
self.color_ctrl = wx.Choice(
self, -1, choices=["grayscale", "rainbow", "heatmap", "invert"]
)
self.color_ctrl.SetSelection(0)
grid.Add(self.color_ctrl, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
self._sizer.Fit(self)
box = wx.BoxSizer(wx.HORIZONTAL)
s.Add(box)
txt2 = wx.StaticText(self, -1, "Brightness")
box.Add(txt2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
self.brightness_ctrl = wx.Slider(
self, -1, size=(200, -1), style=wx.SL_AUTOTICKS | wx.SL_LABELS
)
box.Add(self.brightness_ctrl, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
self.brightness_ctrl.SetMin(1)
self.brightness_ctrl.SetMax(500)
self.brightness_ctrl.SetValue(self.settings.brightness)
self.brightness_ctrl.SetTickFreq(25)
self.center_ctrl = wx.CheckBox(self, -1, "Mark beam center")
self.center_ctrl.SetValue(self.settings.show_beam_center)
s.Add(self.center_ctrl, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
self.spots_ctrl = wx.CheckBox(self, -1, "Show spotfinder results")
self.spots_ctrl.SetValue(self.settings.show_spotfinder_spots)
s.Add(self.spots_ctrl, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
self.integ_ctrl = wx.CheckBox(self, -1, "Show integration results")
self.integ_ctrl.SetValue(self.settings.show_integration)
s.Add(self.integ_ctrl, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
# self.invert_ctrl = wx.CheckBox(self, -1, "Invert beam center axes")
# self.invert_ctrl.SetValue(self.settings.invert_beam_center_axes)
# s.Add(self.invert_ctrl, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
self.Bind(wx.EVT_CHOICE, self.OnUpdate, self.zoom_ctrl)
self.Bind(wx.EVT_CHOICE, self.OnUpdate, self.color_ctrl)
self.Bind(wx.EVT_SLIDER, self.OnUpdateBrightness, self.brightness_ctrl)
self.Bind(wx.EVT_CHECKBOX, self.OnUpdate2, self.center_ctrl)
self.Bind(wx.EVT_CHECKBOX, self.OnUpdate2, self.spots_ctrl)
txt3 = wx.StaticText(self, -1, "Thumbnail view:")
s.Add(txt3, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
self.thumb_panel = rstbx.viewer.display.ThumbnailView(
parent=self, size=(256, 256), style=wx.SUNKEN_BORDER
)
s.Add(self.thumb_panel, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
# self.Bind(wx.EVT_CHECKBOX, self.OnUpdate2, self.invert_ctrl)