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


Python wx.EVT_CHAR_HOOK属性代码示例

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


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

示例1: finish_widget_creation

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR_HOOK [as 别名]
def finish_widget_creation(self, level):
        self.widget.Bind(wx.EVT_SIZE, self.on_size)

        # store the actual values of font as default, if the property is deactivated later
        fnt = self.widget.GetFont()
        if not fnt.IsOk(): fnt = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
        self._original['font'] = fnt

        if self.check_prop_truth("font"): self._set_font()
        if self.check_prop_truth("wrap"): self.widget.Wrap(self.wrap)
        if self.check_prop("size"):       self.set_size()
        if self.check_prop("background"): self.widget.SetBackgroundColour(self.background)
        if self.check_prop("foreground"): self.widget.SetForegroundColour(self.foreground)

        EditBase.finish_widget_creation(self, level)

        self.widget.Bind(wx.EVT_CHAR_HOOK, self.on_char_hook) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:19,代码来源:edit_windows.py

示例2: on_char_editor

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR_HOOK [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() 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:20,代码来源:new_properties.py

示例3: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR_HOOK [as 别名]
def __init__(self, *args, **kwds):
        # begin wxGlade: Terminal.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_NO_TASKBAR | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP
        wx.Frame.__init__(self, *args, **kwds)
        Module.__init__(self)
        self.SetSize((581, 410))
        self.text_main = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_BESTWRAP | wx.TE_MULTILINE | wx.TE_READONLY)
        self.text_entry = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB)

        self.__set_properties()
        self.__do_layout()
        # self.Bind(wx.EVT_TEXT, self.on_key_down, self.text_entry)
        self.Bind(wx.EVT_CHAR_HOOK, self.on_key_down, self.text_entry)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_entry, self.text_entry)
        # end wxGlade
        self.Bind(wx.EVT_CLOSE, self.on_close, self)
        self.pipe = None
        self.command_log = []
        self.command_position = 0 
开发者ID:meerk40t,项目名称:meerk40t,代码行数:21,代码来源:Terminal.py

示例4: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR_HOOK [as 别名]
def __init__(self, parent):
        super(View, self).__init__(parent)
        self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
        self.Bind(wx.EVT_SIZE, self.on_size)
        self.Bind(wx.EVT_PAINT, self.on_paint)
        self.Bind(wx.EVT_CHAR_HOOK, self.on_char)
        self.index = -1
        self.weights = {}
        self.model = None
        self.bitmap = None
        wx.CallAfter(self.next) 
开发者ID:fogleman,项目名称:GraphLayout,代码行数:13,代码来源:viewer.py

示例5: destroy_widget

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR_HOOK [as 别名]
def destroy_widget(self, level):
        if self.preview_widget is not None:
            self.preview_widget.Unbind(wx.EVT_CHAR_HOOK)
            compat.DestroyLater(self.preview_widget)
            self.preview_widget = None
        WindowBase.destroy_widget(self, level) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:8,代码来源:edit_windows.py

示例6: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR_HOOK [as 别名]
def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        common.palette = self # for building the buttons
        self.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_BTNFACE) )

        # load the available code generators
        all_widgets = common.init_codegen()
        if not config.use_gui: return
        self.all_togglebuttons = []  # used by reset_togglebuttons

        # for keyboard navigation:
        self._id_to_coordinate = {}
        self._ids_by_row = []
        self._section_to_row = {}

        # build the palette for all_widgets
        sizer = wx.FlexGridSizer(0, 2, 0, 0)
        maxlen = max([len(all_widgets[sect]) for sect in all_widgets])  # the maximum number of buttons in a section
        for row, section in enumerate(all_widgets):
            self._section_to_row[section] = row
            self._ids_by_row.append([])
            if section:
                label = wx.StaticText(self, -1, "%s:" % section.replace('&', '&&'))
                sizer.Add( label, 1, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 2 )
            bsizer = wx.BoxSizer()
            for col, button in enumerate(all_widgets[section]):
                self._ids_by_row[-1].append(button.Id)
                self._id_to_coordinate[button.Id] = (row,col)
                bsizer.Add(button, flag=wx.ALL, border=1)
                if isinstance(button, wx.ToggleButton):
                    self.all_togglebuttons.append(button)
            sizer.Add(bsizer)
        self.SetSizer(sizer)
        # on platforms other than Windows, we'll set the ToggleButton background colour to indicate the selection
        if wx.Platform == "__WXMSW__":
            self._highlight_colour = None
        else:
            self._highlight_colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_HIGHLIGHT)
        self.Bind(wx.EVT_CHAR_HOOK, self.on_char) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:41,代码来源:main.py

示例7: on_char_hook

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR_HOOK [as 别名]
def on_char_hook(self, event):
        # bound to EVT_CHAR_HOOK
        focus = parent = self.FindFocus()
        grid = None  # will be set if a grid or a grid's child is focused
        window_type = None
        while parent:
            # go up and identify parent: Palette, Property or Tree
            if isinstance(parent, wx.grid.Grid):
                grid = parent
            if parent is self.palette:
                window_type = "palette"
            elif parent is self.tree:
                window_type = "tree"
            elif parent is self.property_panel:
                window_type = "properties"
            if window_type: break
            parent = parent.GetParent()

        # forward to specific controls / properties? (on wx 2.8 installing EVT_CHAR_HOOK on controls does not work)
        if window_type=="properties" and grid and grid.Name!="grid":
            # forward event to grid property?
            if misc.focused_widget.properties[grid.Name].on_char(event):
                return
        if window_type=="tree":
            if common.app_tree.on_char(event):
                return

        # global handler
        misc.handle_key_event(event, window_type) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:31,代码来源:main.py

示例8: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR_HOOK [as 别名]
def __init__(self, parent, application):
        style = wx.TR_DEFAULT_STYLE|wx.TR_HAS_VARIABLE_ROW_HEIGHT
        style |= wx.TR_EDIT_LABELS
        if wx.Platform == '__WXGTK__':    style |= wx.TR_NO_LINES|wx.TR_FULL_ROW_HIGHLIGHT
        elif wx.Platform == '__WXMAC__':  style &= ~wx.TR_ROW_LINES
        wx.TreeCtrl.__init__(self, parent, -1, style=style)
        self.cur_widget = None  # reference to the selected widget
        self.root = application
        image_list = wx.ImageList(21, 21)
        image_list.Add(wx.Bitmap(os.path.join(config.icons_path, 'application.xpm'), wx.BITMAP_TYPE_XPM))
        for w in WidgetTree.images:
            WidgetTree.images[w] = image_list.Add(misc.get_xpm_bitmap(WidgetTree.images[w]))
        self.AssignImageList(image_list)
        application.item = self.AddRoot(_('Application'), 0)
        self._SetItemData(application.item, application)
        self.skip_select = 0  # avoid an infinite loop on win32, as SelectItem fires an EVT_TREE_SEL_CHANGED event

        self.drop_target = clipboard.DropTarget(self, toplevel=True)
        self.SetDropTarget(self.drop_target)
        self._drag_ongoing = False
        self.auto_expand = True  # this control the automatic expansion of  nodes: it is set to False during xml loading
        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.on_change_selection)
        self.Bind(wx.EVT_RIGHT_DOWN, self.popup_menu)
        self.Bind(wx.EVT_LEFT_DCLICK, self.on_left_dclick)
        self.Bind(wx.EVT_LEFT_DOWN, self.on_left_click) # allow direct placement of widgets
        self.Bind(wx.EVT_MENU, self.on_menu)  # for handling the selection of the first item
        self._popup_menu_widget = None  # the widget for the popup menu
        self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.begin_drag)
        self.Bind(wx.EVT_LEAVE_WINDOW, self.on_leave_window)
        self.Bind(wx.EVT_MOUSE_EVENTS, self.on_mouse_events)

        self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.begin_edit_label)
        self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.end_edit_label)
        #self.Bind(wx.EVT_KEY_DOWN, misc.on_key_down_event)
        self.Bind(wx.EVT_KEY_DOWN, self.on_key_down_event)
        #self.Bind(wx.EVT_CHAR_HOOK, self.on_char)  # on wx 2.8 the event will not be delivered to the child
        self.Bind(wx.EVT_TREE_DELETE_ITEM, self.on_delete_item) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:39,代码来源:tree.py

示例9: bind_event_handlers

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR_HOOK [as 别名]
def bind_event_handlers(self):
        self.Bind(wx.EVT_TEXT, self.on_label_edited, self.label)
        self.Bind(wx.EVT_TEXT, self.on_event_handler_edited, self.event_handler)
        self.Bind(wx.EVT_TEXT, self.on_name_edited, self.name)
        self.Bind(wx.EVT_TEXT, self.on_help_str_edited, self.help_str)
        self.Bind(wx.EVT_TEXT, self.on_id_edited, self.id)
        self.Bind(wx.EVT_RADIOBOX, self.on_type_edited, self.type)

        self.Bind(wx.EVT_BUTTON, self.move_item_left, self.move_left)
        self.Bind(wx.EVT_BUTTON, self.move_item_right, self.move_right)
        self.Bind(wx.EVT_BUTTON, self.move_item_up, self.move_up)
        self.Bind(wx.EVT_BUTTON, self.move_item_down, self.move_down)
        self.Bind(wx.EVT_BUTTON, self.add_item, self.add)
        self.Bind(wx.EVT_BUTTON, self.remove_item, self.remove)
        self.Bind(wx.EVT_BUTTON, self.add_separator, self.add_sep)
        self.Bind(wx.EVT_BUTTON, self.on_cancel, self.cancel)
        self.Bind(wx.EVT_BUTTON, self.on_OK, self.ok)
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.show_item, self.items)

        self.Bind(wx.EVT_CHAR_HOOK, self.on_char)
        self.remove.Bind(wx.EVT_CHAR_HOOK, self.on_button_char)  # to ignore the Enter key while the focus is on Remove

        self.items.Bind(wx.EVT_MOUSEWHEEL, lambda e: e.Skip())  # workaround to make the scroll wheel work...

        for c,header in enumerate(self.headers):
            self.items.InsertColumn(c, _(header))
            self.items.SetColumnWidth(c, self.column_widths[c]) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:29,代码来源:menubar.py

示例10: bind_event_handlers

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR_HOOK [as 别名]
def bind_event_handlers(self):
        self.Bind(wx.EVT_TEXT, self.on_label_edited, self.label)
        self.Bind(wx.EVT_TEXT, self.on_event_handler_edited, self.handler)
        self.Bind(wx.EVT_TEXT, self.on_help_str_edited, self.short_help)
        self.Bind(wx.EVT_TEXT, self.on_long_help_str_edited, self.long_help)
        self.Bind(wx.EVT_TEXT, self.on_id_edited, self.id)
        self.Bind(wx.EVT_RADIOBOX, self.on_type_edited, self.type)

        self.Bind(wx.EVT_BUTTON, self.move_item_up, self.move_up)
        self.Bind(wx.EVT_BUTTON, self.move_item_down, self.move_down)
        self.Bind(wx.EVT_BUTTON, self.add_item, self.add)
        self.Bind(wx.EVT_BUTTON, self.remove_item, self.remove)
        self.Bind(wx.EVT_BUTTON, self.add_separator, self.add_sep)
        self.Bind(wx.EVT_BUTTON, self.on_cancel, self.cancel)
        self.Bind(wx.EVT_BUTTON, self.on_OK, self.ok)
        self.Bind(wx.EVT_BUTTON, self.select_bitmap1, self.bitmap1_button)
        self.Bind(wx.EVT_BUTTON, self.select_bitmap2, self.bitmap2_button)
        self.Bind(wx.EVT_TEXT, self.on_bitmap1_edited, self.bitmap1)
        self.Bind(wx.EVT_TEXT, self.on_bitmap2_edited, self.bitmap2)
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.show_item, self.items)

        self.Bind(wx.EVT_CHAR_HOOK, self.on_char)
        self.remove.Bind(wx.EVT_CHAR_HOOK, self.on_button_char)  # to ignore the Enter key while the focus is on Remove

        self.items.Bind(wx.EVT_MOUSEWHEEL, lambda e: e.Skip())  # workaround to make the scroll wheel work...

        for c,header in enumerate(self.headers):
            self.items.InsertColumn(c, _(header))
            self.items.SetColumnWidth(c, self.column_widths[c]) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:31,代码来源:toolbar.py

示例11: on_char_hook

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR_HOOK [as 别名]
def on_char_hook(self, event):
        # handler for EVT_CHAR_HOOK events on preview windows
        if event.GetKeyCode()==wx.WXK_ESCAPE:
            wx.FindWindowById(event.GetId()).GetTopLevelParent().Close()
            return
        misc.handle_key_event(event, "preview") 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:8,代码来源:application.py

示例12: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR_HOOK [as 别名]
def __init__(self, parent, ctr):
        self.ctr = ctr
        wx.Dialog.__init__(self,
                           name='IDManager', parent=parent,
                           title=_('URI Editor'),
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
                           size=(800, 600))
        # start IDBrowser in manager mode
        self.browser = IDBrowser(self, ctr)
        self.Bind(wx.EVT_CHAR_HOOK, self.OnEscapeKey) 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:12,代码来源:IDManager.py

示例13: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR_HOOK [as 别名]
def __init__(self, parent, title, question, optiontext, button_texts):
        wx.Dialog.__init__(self, parent, title=title)

        main_sizer = wx.BoxSizer(wx.VERTICAL)

        message = wx.StaticText(self, label=question)
        main_sizer.AddWindow(message, border=20,
                             flag=wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.LEFT | wx.RIGHT)

        self.check = wx.CheckBox(self, label=optiontext)
        main_sizer.AddWindow(self.check, border=20,
                             flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.ALIGN_CENTER_HORIZONTAL)

        buttons_sizer = wx.BoxSizer(wx.HORIZONTAL)
        for label, wxID in zip(button_texts, [wx.ID_YES, wx.ID_NO, wx.ID_CANCEL]):
            Button = wx.Button(self, label=label)

            def OnButtonFactory(_wxID):
                return lambda event: self.EndModal(_wxID)

            self.Bind(wx.EVT_BUTTON, OnButtonFactory(wxID), Button)
            buttons_sizer.AddWindow(Button)

        main_sizer.AddSizer(buttons_sizer, border=20,
                            flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.ALIGN_RIGHT)

        self.SetSizer(main_sizer)
        self.Fit()

        self.Bind(wx.EVT_CHAR_HOOK, self.OnEscapeKey) 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:32,代码来源:IDMergeDialog.py


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