本文整理汇总了Python中wx.WXK_DOWN属性的典型用法代码示例。如果您正苦于以下问题:Python wx.WXK_DOWN属性的具体用法?Python wx.WXK_DOWN怎么用?Python wx.WXK_DOWN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.WXK_DOWN属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_char_editor
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DOWN [as 别名]
def on_char_editor(self, event):
# EVT_CHAR_HOOK handler
keycode = event.KeyCode
if keycode not in (wx.WXK_RETURN, wx.WXK_ESCAPE, wx.WXK_UP, wx.WXK_DOWN):
event.Skip()
return
if keycode == wx.WXK_ESCAPE:
self._update_editors()
return
self._on_editor_edited(event)
if keycode==wx.WXK_UP:
self._set_row_index( self.cur_row - 1 )
elif keycode==wx.WXK_DOWN:
self._set_row_index( self.cur_row + 1 )
self._update_editors()
示例2: onFrameCharHook
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DOWN [as 别名]
def onFrameCharHook(self, event):
keyCode = event.GetKeyCode()
if keyCode == wx.WXK_F4:
if event.AltDown():
self.destroyMenu()
elif keyCode == wx.WXK_RETURN or keyCode == wx.WXK_NUMPAD_ENTER:
self.GoTo()
elif keyCode == wx.WXK_RIGHT or keyCode == wx.WXK_NUMPAD_RIGHT:
self.MoveCursor(1)
elif keyCode == wx.WXK_ESCAPE:
self.destroyMenu()
elif keyCode == wx.WXK_UP or keyCode == wx.WXK_NUMPAD_UP:
self.Turn(1)
elif keyCode == wx.WXK_DOWN or keyCode == wx.WXK_NUMPAD_DOWN:
self.Turn(-1)
elif keyCode == wx.WXK_LEFT or keyCode == wx.WXK_NUMPAD_LEFT:
self.MoveCursor(-1)
else:
event.Skip()
示例3: OnKeyDown
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DOWN [as 别名]
def OnKeyDown(self, event):
""" Do some work when the user press on the keys:
up and down: move the cursor
"""
keycode = event.GetKeyCode()
if keycode in [wx.WXK_DOWN, wx.WXK_UP]:
self.PopupListBox()
if keycode == wx.WXK_DOWN:
self.listbox.MoveSelection(1)
else:
self.listbox.MoveSelection(-1)
elif keycode in [wx.WXK_LEFT, wx.WXK_RIGHT, wx.WXK_RETURN] and self.listbox is not None:
selected = self.listbox.GetSelection()
if selected != "":
self.SetValueFromSelected(selected)
else:
event.Skip()
elif event.GetKeyCode() == wx.WXK_ESCAPE:
self.DismissListBox()
else:
event.Skip()
示例4: OnKeyDown
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DOWN [as 别名]
def OnKeyDown(self, event):
"""
Called when key is pressed in SearchCtrl text control
@param event: wx.KeyEvent
"""
# Get event keycode and value in SearchCtrl
keycode = event.GetKeyCode()
search_value = self.SearchCtrl.GetValue()
# Up key was pressed and SearchCtrl isn't empty, search for block in
# 'previous' mode
if keycode == wx.WXK_UP and search_value != "":
self.SearchInTree(search_value, "previous")
# Down key was pressed and SearchCtrl isn't empty, search for block in
# 'next' mode
elif keycode == wx.WXK_DOWN and search_value != "":
self.SearchInTree(search_value, "next")
# Handle key normally
else:
event.Skip()
示例5: OnKeyDown
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DOWN [as 别名]
def OnKeyDown(self, event):
button = None
keycode = event.GetKeyCode()
if keycode in (wx.WXK_ADD, wx.WXK_NUMPAD_ADD):
button = self.GetNewButton()
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE):
button = self.GetDelButton()
elif keycode == wx.WXK_UP and event.ShiftDown():
button = self.GetUpButton()
elif keycode == wx.WXK_DOWN and event.ShiftDown():
button = self.GetDownButton()
elif keycode == wx.WXK_SPACE:
button = self.GetEditButton()
if button is not None and button.IsEnabled():
button.ProcessEvent(wx.CommandEvent(wx.EVT_BUTTON.typeId, button.GetId()))
else:
event.Skip()
示例6: OnKeyPressed
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DOWN [as 别名]
def OnKeyPressed(self, event=None):
if event.GetKeyCode() == wx.WXK_RIGHT:
self.nextImage(event=None)
elif event.GetKeyCode() == wx.WXK_LEFT:
self.prevImage(event=None)
elif event.GetKeyCode() == wx.WXK_DOWN:
self.nextLabel(event=None)
elif event.GetKeyCode() == wx.WXK_UP:
self.previousLabel(event=None)
elif event.GetKeyCode() == wx.WXK_BACK:
pos_abs = event.GetPosition()
inv = self.axes.transData.inverted()
pos_rel = list(inv.transform(pos_abs))
pos_rel[1] = (
self.axes.get_ylim()[0] - pos_rel[1]
) # Recall y-axis is inverted
i = np.nanargmin(
[self.calc_distance(*dp.point.center, *pos_rel) for dp in self.drs]
)
closest_dp = self.drs[i]
msg = wx.MessageBox(
f"Do you want to remove the label {closest_dp.individual_names}:{closest_dp.bodyParts}?",
"Remove!",
wx.YES_NO | wx.ICON_WARNING,
)
if msg == 2:
closest_dp.delete_data()
self.buttonCounter[closest_dp.individual_names].remove(
closest_dp.bodyParts
)
示例7: OnKeyPressed
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DOWN [as 别名]
def OnKeyPressed(self, event=None):
if event.GetKeyCode() == wx.WXK_RIGHT:
self.nextImage(event=None)
elif event.GetKeyCode() == wx.WXK_LEFT:
self.prevImage(event=None)
elif event.GetKeyCode() == wx.WXK_DOWN:
self.nextLabel(event=None)
elif event.GetKeyCode() == wx.WXK_UP:
self.previousLabel(event=None)
elif event.GetKeyCode() == wx.WXK_BACK:
pos_abs = event.GetPosition()
inv = self.axes.transData.inverted()
pos_rel = list(inv.transform(pos_abs))
pos_rel[1] = (
self.axes.get_ylim()[0] - pos_rel[1]
) # Recall y-axis is inverted
i = np.nanargmin(
[self.calc_distance(*dp.point.center, *pos_rel) for dp in self.drs]
)
closest_dp = self.drs[i]
msg = wx.MessageBox(
"Do you want to remove the label %s ?" % closest_dp.bodyParts,
"Remove!",
wx.YES_NO | wx.ICON_WARNING,
)
if msg == 2:
closest_dp.delete_data()
self.buttonCounter.remove(
self.bodyparts.index(closest_dp.bodyParts)
)
示例8: on_char
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DOWN [as 别名]
def on_char(self, event):
key = (event.GetKeyCode(), event.GetModifiers()) # modifiers: 1,2,4 for Alt, Ctrl, Shift
focused = self.FindFocus()
if not focused or not focused.Id in self._id_to_coordinate:
return event.Skip()
row, col = self._id_to_coordinate[focused.Id]
new_row = new_col = None
if key[0]==wx.WXK_UP:
if row>0: new_row = row-1
elif key[0]==wx.WXK_DOWN:
if row < len(self._ids_by_row)-1: new_row = row+1
elif key[0]==wx.WXK_LEFT:
if col>0: new_col = col-1
elif key[0]==wx.WXK_RIGHT:
if col < len(self._ids_by_row[row])-1: new_col = col+1
elif key[0]==wx.WXK_HOME:
new_col = 0
elif key[0]==wx.WXK_END:
new_col = len(self._ids_by_row[row])-1
elif key[0]==wx.WXK_PAGEUP:
new_row = 0
elif key[0]==wx.WXK_PAGEDOWN:
new_row = len(self._ids_by_row)-1
elif (ord("A") <= key[0] <= ord("Z")) and chr(key[0]) in misc.palette_hotkeys:
section = misc.palette_hotkeys[chr(key[0])]
new_row = self._section_to_row[section]
new_col = 0
else:
return event.Skip()
if new_row is None and new_col is None:
# limits hit
wx.Bell()
else:
if new_col is None: new_col = min(col, len(self._ids_by_row[new_row])-1)
if new_row is None: new_row = row
focus = self.FindWindowById(self._ids_by_row[new_row][new_col])
if focus: focus.SetFocus()
示例9: on_char
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DOWN [as 别名]
def on_char(self, event):
"called from main: start label editing on F2; skip events while editing"
keycode = event.GetKeyCode()
if keycode==wx.WXK_F2 and self.cur_widget and self.cur_widget._label_editable():
# start label editing
self.EditLabel( self.cur_widget.item )
return True
if isinstance(self.FindFocus(), wx.TextCtrl):
# currently editing
event.Skip()
return True
if keycode in (wx.WXK_UP, wx.WXK_DOWN, wx.WXK_LEFT, wx.WXK_RIGHT):
event.Skip()
return True
return False
示例10: OnChar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DOWN [as 别名]
def OnChar(self, event):
key = event.GetKeyCode()
if key == wx.WXK_UP:
self.OnSpinUp(event)
return
if key == wx.WXK_DOWN:
self.OnSpinDown(event)
return
event.Skip()
示例11: on_key_down
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DOWN [as 别名]
def on_key_down(self, event):
key = event.GetKeyCode()
try:
if key == wx.WXK_DOWN:
self.text_entry.SetValue(self.command_log[self.command_position + 1])
wx.CallAfter(self.text_entry.SetInsertionPointEnd)
self.command_position += 1
elif key == wx.WXK_UP:
self.text_entry.SetValue(self.command_log[self.command_position - 1])
wx.CallAfter(self.text_entry.SetInsertionPointEnd)
self.command_position -= 1
except IndexError:
pass
event.Skip()
示例12: OnKeyDown
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DOWN [as 别名]
def OnKeyDown(self, event):
key_handled = False
keycode = event.GetKeyCode()
if keycode == wx.WXK_TAB:
row = self.GetGridCursorRow()
col = self.GetGridCursorCol()
if event.ShiftDown():
if row < 0 or col == 0:
self.Navigate(wx.NavigationKeyEvent.IsBackward)
key_handled = True
elif row < 0 or col == self.Table.GetNumberCols() - 1:
self.Navigate(wx.NavigationKeyEvent.IsForward)
key_handled = True
elif keycode in (wx.WXK_ADD, wx.WXK_NUMPAD_ADD) and self.Editable:
self.AddRow()
key_handled = True
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and self.Editable:
self.DeleteRow()
key_handled = True
elif keycode == wx.WXK_UP and event.ShiftDown() and self.Editable:
self.MoveRow(self.GetGridCursorRow(), -1)
key_handled = True
elif keycode == wx.WXK_DOWN and event.ShiftDown() and self.Editable:
self.MoveRow(self.GetGridCursorRow(), 1)
key_handled = True
if not key_handled:
event.Skip()
示例13: OnKeyDown
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DOWN [as 别名]
def OnKeyDown(self, event):
key = event.GetUnicodeKey()
if key == wx.WXK_NONE:
key = event.GetKeyCode()
dxs = {wx.WXK_LEFT: -1, wx.WXK_RIGHT: +1, wx.WXK_UP: 0, wx.WXK_DOWN: 0}
dys = {wx.WXK_LEFT: 0, wx.WXK_RIGHT: 0, wx.WXK_UP: +1, wx.WXK_DOWN: -1}
if key in dxs:
dx = dxs[key]
dy = dys[key]
if event.ShiftDown():
scale = 0.1
else:
scale = 1.0
self.do_Step(dx, dy, scale)
示例14: barcodeInput
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DOWN [as 别名]
def barcodeInput(self, event):
if event.GetKeyCode() == wx.WXK_UP:
self.suggestionList.SetSelection(self.suggestionList.GetSelection() - 1)
return
elif event.GetKeyCode() == wx.WXK_DOWN:
self.suggestionList.SetSelection(self.suggestionList.GetSelection() + 1)
return
c = event.GetUnicodeKey()
if c is 8:
# backspace
self.inputStream = self.inputStream[:-1]
if c is 27:
# esc key
self.inputStream = ''
if c in range(48, 91):
# number or alphabet
self.inputStream = self.inputStream + chr(c)
if c is 13:
# enter key
listSelection = self.suggestionList.GetString(self.suggestionList.GetSelection())
print(listSelection)
if listSelection == "New Product":
self.newProd(self.inputTC.GetValue())
# i had to make the connection again because it wasn't fetching values (this was moved to cart.py)
# self.t.conn = connectToDB()
x = self.t.findProduct(self.inputTC.GetValue(), 1)
print(x)
else:
x = self.t.findProduct(listSelection.split()[0], 1)
if x == True:
self.dumpCartInDvlc()
self.inputStream = ''
self.hideSearchSuggestion(None)
'''
else:
x = self.t.findProduct( listSelection.split()[0] , 1 )
print(x)
if x == True:
self.dumpCartInDvlc()
self.inputStream = ''
self.hideSearchSuggestion(None)
'''
self.inputTC.SetValue(self.inputStream)
示例15: barcodeInput
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_DOWN [as 别名]
def barcodeInput (self, event):
if event.GetKeyCode() == wx.WXK_UP:
self.suggestionList.SetSelection( self.suggestionList.GetSelection() -1 )
return
elif event.GetKeyCode() == wx.WXK_DOWN:
self.suggestionList.SetSelection( self.suggestionList.GetSelection() +1 )
return
c = event.GetUnicodeKey()
if c is 8:
# backspace
self.inputStream = self.inputStream[:-1]
if c is 27:
# esc key
self.inputStream = ''
if c in range(48, 91):
# number or alphabet
self.inputStream = self.inputStream + chr(c)
if c is 13:
# enter key
listSelection = self.suggestionList.GetString( self.suggestionList.GetSelection() )
print ('print list: ' + str(listSelection))
if listSelection == "New Product":
self.newProd( self.inputTC.GetValue() )
# i had to make the connection again because it wasn't fetching values (this was moved to cart.py)
#self.t.conn = connectToDB()
x = self.t.findProduct( self.inputTC.GetValue() , 1 )
print('print x: ' + str(x))
else:
x = self.t.findProduct( listSelection.split()[0] , 1 )
if x == True:
self.dumpCartInDvlc()
self.inputStream = ''
self.hideSearchSuggestion(None)
'''
else:
x = self.t.findProduct( listSelection.split()[0] , 1 )
print(x)
if x == True:
self.dumpCartInDvlc()
self.inputStream = ''
self.hideSearchSuggestion(None)
'''
print('print inoutstream:' + str(self.inputStream))
self.inputTC.SetValue(self.inputStream)