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


Python wx.TreeCtrl方法代码示例

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


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

示例1: RecurseActionGroup

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TreeCtrl [as 别名]
def RecurseActionGroup(self, actionGroup, tree, parentTreeItem):
        """
        Recurses an eg.ActionGroup and adds the items to the TreeCtrl.
        """
        for dataItem in actionGroup.items:
            if isinstance(dataItem, eg.ActionGroup):
                # the dataItem is an eg.ActionGroup instance
                isActionGroup = True
                if not len(dataItem.items):
                    # don't add empty ActionGroups
                    continue
                iconIndex = dataItem.icon.folderIndex
            else:
                # the dataItem is an action
                isActionGroup = False
                iconIndex = dataItem.info.icon.index
            newTreeItem = tree.AppendItem(parentTreeItem, dataItem.name)
            tree.SetPyData(newTreeItem, dataItem)
            tree.SetItemImage(newTreeItem, iconIndex)
            if isActionGroup:
                self.RecurseActionGroup(dataItem, tree, newTreeItem)
                if dataItem.expanded:
                    tree.Expand(newTreeItem)
            if dataItem == self.lastSelectedDataItem:
                self.lastSelectedTreeItem = newTreeItem 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:27,代码来源:AddActionDialog.py

示例2: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TreeCtrl [as 别名]
def __init__(self,
                  parent,
                  ID=wx.NewId(),
                  pos=wx.DefaultPosition,
                  size=wx.DefaultSize,
                  style=0,
                  clientpanel=None):
        """Constructor. Initializes a smartcard or reader tree control."""
        wx.TreeCtrl.__init__(
            self, parent, ID, pos, size, wx.TR_SINGLE | wx.TR_NO_BUTTONS)

        self.clientpanel = clientpanel
        self.parent = parent

        isz = (16, 16)
        il = wx.ImageList(isz[0], isz[1])
        self.capindex = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_HELP_BOOK, wx.ART_OTHER, isz))
        self.fldrindex = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz))
        self.fldropenindex = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz))
        if None != ICO_SMARTCARD:
            self.cardimageindex = il.Add(
                wx.Bitmap(ICO_SMARTCARD, wx.BITMAP_TYPE_ICO))
        if None != ICO_READER:
            self.readerimageindex = il.Add(
                wx.Bitmap(ICO_READER, wx.BITMAP_TYPE_ICO))
        self.il = il
        self.SetImageList(self.il) 
开发者ID:LudovicRousseau,项目名称:pyscard,代码行数:32,代码来源:CardAndReaderTreePanel.py

示例3: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TreeCtrl [as 别名]
def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, -1, title, size=(600, 400))
        w, h = self.GetClientSizeTuple()
        self.tree = wx.TreeCtrl(
            self,
            wx.NewId(),
            wx.DefaultPosition,
            (w, h),
            wx.TR_HAS_BUTTONS | wx.TR_EDIT_LABELS)
        self.InitTree()
        self.OnExpandAll() 
开发者ID:LudovicRousseau,项目名称:pyscard,代码行数:13,代码来源:pcscdiag.py

示例4: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TreeCtrl [as 别名]
def __init__(self, parent, style):
        wx.TreeCtrl.__init__(self, parent=parent, style=style) 
开发者ID:cmpilato,项目名称:thotkeeper,代码行数:4,代码来源:app.py

示例5: OnInit

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TreeCtrl [as 别名]
def OnInit(self):
        f = wx.Frame(None)
        t = wx.TreeCtrl(f, style=0
                           | wx.TR_HAS_BUTTONS
                           | wx.TR_TWIST_BUTTONS
                           | wx.TR_FULL_ROW_HIGHLIGHT
                           #| wx.TR_HIDE_ROOT 
                           #| wx.TR_ROW_LINES
                           | wx.TR_MULTIPLE
                           | wx.TR_EXTENDED
                           #| wx.TR_NO_LINES
                           #| wx.NO_FULL_REPAINT_ON_RESIZE
                           | wx.CLIP_CHILDREN
                          ,)
            
        
        r = t.AddRoot("Profile")

        g = GuiStats(sys.argv[1])
        g.gui_print(t, r)
    
        t.Expand(r)
        f.Show(True)


        
        return True 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:29,代码来源:profile_gui.py

示例6: GetCurrentTree

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TreeCtrl [as 别名]
def GetCurrentTree(wnd=None):
  while wnd:
    if isinstance(wnd, wx.TreeCtrl):
      return wnd
    wnd=wnd.GetParent()

  frame=GetCurrentFrame()
  if frame and hasattr(frame, "tree"):
    return frame.tree
  return None 
开发者ID:andreas-p,项目名称:admin4,代码行数:12,代码来源:adm.py

示例7: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TreeCtrl [as 别名]
def __init__(self, parentWin, name, size=wx.DefaultSize, style=wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT):
    wx.TreeCtrl.__init__(self, parentWin, size=size, style=style)
    self.SetImageList(adm.images)
    self.AddRoot(name)
    if wx.Platform != "__WXMSW__":
      pt=parentWin.GetFont().GetPointSize() * 0.95  # a little smaller
      font=wx.Font(pt, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.NORMAL)

      self.SetFont(font) 
开发者ID:andreas-p,项目名称:admin4,代码行数:11,代码来源:tree.py

示例8: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TreeCtrl [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: create_widget

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TreeCtrl [as 别名]
def create_widget(self):
        self.widget = wx.TreeCtrl(self.parent_window.widget, self.id, style=self.style) # wx.TR_HAS_BUTTONS|wx.BORDER_SUNKEN)
        # add a couple of items just for a better appearance
        root = self.widget.AddRoot(_(' Tree Control:'))
        self._item_with_name = self.widget.AppendItem(root, ' ' + self.name)
        self.widget.AppendItem(self._item_with_name, _(' on wxGlade version %s') % config.version )
        self.widget.Expand(root)
        self.widget.Expand(self._item_with_name) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:10,代码来源:tree_ctrl.py

示例10: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TreeCtrl [as 别名]
def __init__(self, parent, id, title, size):
        wx.Frame.__init__(self, parent, id, title,
                          style=wx.DEFAULT_FRAME_STYLE ^ (wx.RESIZE_BORDER | wx.MINIMIZE_BOX |
                                                          wx.MAXIMIZE_BOX))
        self.SetSize(size)
        self.Center()
        self.sourceLabel = wx.StaticText(self, label='Source Image', pos=(150, 10), size=(40, 25))
        self.detectionLabel = wx.StaticText(self, label='Detection Image', pos=(550, 10), size=(40, 25))
        self.openPicButton = wx.Button(self, label='Open Image', pos=(830, 30), size=(150, 30))
        self.openPicButton.Bind(wx.EVT_BUTTON, self.open_picture)
        self.openEditorButton = wx.Button(self, label='Open Rule Editor', pos=(830, 70), size=(150, 30))
        self.openEditorButton.Bind(wx.EVT_BUTTON, self.open_rule_editor)
        self.showRuleButton = wx.Button(self, label='Show Rules', pos=(830, 110), size=(150, 30))
        self.showRuleButton.Bind(wx.EVT_BUTTON, self.show_rules)
        self.showFactButton = wx.Button(self, label='Show Facts', pos=(830, 150), size=(150, 30))
        self.showFactButton.Bind(wx.EVT_BUTTON, self.show_facts)
        self.treeLabel = wx.StaticText(self, label='What shape do you want', pos=(830, 200), size=(40, 25))
        self.shapeTree = wx.TreeCtrl(self, pos=(830, 220), size=(160, 210))
        root = self.shapeTree.AddRoot('All Shapes')
        self.add_tree_nodes(root, shape_items.tree)
        self.shapeTree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.shape_chosen)
        self.shapeTree.Expand(root)
        self.show_picture('init_source.png', (10, 30))
        self.show_picture('init_detection.png', (420, 30))
        self.resultLabel = wx.StaticText(self, label='Detection Result', pos=(100, 450), size=(40, 25))
        self.resultText = wx.TextCtrl(self, pos=(10, 480), size=(310, 280), style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.matchedFactLabel = wx.StaticText(self, label='Matched Facts', pos=(430, 450), size=(40, 25))
        self.matchedFactText = wx.TextCtrl(self, pos=(340, 480), size=(310, 280), style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.hitRuleLabel = wx.StaticText(self, label='Hit Rules', pos=(780, 450), size=(40, 25))
        self.hitRuleText = wx.TextCtrl(self, pos=(670, 480), size=(310, 280), style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.title = title
        self.pic_path = None
        self.engine = None
        self.contour_num = None
        self.Show() 
开发者ID:Sorosliu1029,项目名称:Rule-based_Expert_System,代码行数:37,代码来源:main_frame.py

示例11: OnCmdPython

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TreeCtrl [as 别名]
def OnCmdPython(self):
        eg.PrintNotice("DEBUG: TreeCtrl: OnCmdPython")
        #self.realControl.Copy() 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:5,代码来源:TreeCtrl.py

示例12: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TreeCtrl [as 别名]
def __init__(self, parent, document, size=wx.DefaultSize):
        self.document = document
        self.root = None
        self.editLabelId = None
        self.insertionMark = None
        self.editControl = EditControlProxy(self)
        style = (
            wx.TR_HAS_BUTTONS |
            wx.TR_EDIT_LABELS |
            wx.TR_ROW_LINES |
            wx.CLIP_CHILDREN
        )
        wx.TreeCtrl.__init__(self, parent, size=size, style=style)
        self.SetImageList(eg.Icons.gImageList)
        self.hwnd = self.GetHandle()
        self.normalfont = self.GetFont()
        self.italicfont = self.GetFont()
        self.italicfont.SetStyle(wx.FONTSTYLE_ITALIC)
        self.Bind(wx.EVT_SET_FOCUS, self.OnGetFocusEvent)
        self.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocusEvent)
        self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.OnItemExpandingEvent)
        self.Bind(wx.EVT_TREE_ITEM_COLLAPSING, self.OnItemCollapsingEvent)
        self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.OnBeginLabelEditEvent)
        self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnEndLabelEditEvent)
        self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnItemActivateEvent)
        self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDoubleClickEvent)
        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnRightClickEvent)
        self.Bind(wx.EVT_TREE_ITEM_MENU, self.OnItemMenuEvent)
        self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnBeginDragEvent)
        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectionChangedEvent)
        self.visibleNodes = {}
        self.expandedNodes = document.expandedNodes
        self.dropTarget = DropTarget(self)
        self.SetDropTarget(self.dropTarget)
        eg.Bind("NodeAdded", self.OnNodeAdded)
        eg.Bind("NodeDeleted", self.OnNodeDeleted)
        eg.Bind("NodeChanged", self.OnNodeChanged)
        eg.Bind("NodeSelected", self.OnNodeSelected)
        eg.Bind("DocumentNewRoot", self.OnNewRoot)
        if document.root:
            self.OnNewRoot(document.root) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:43,代码来源:TreeCtrl.py

示例13: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TreeCtrl [as 别名]
def __init__(self, parent, includeInvisible=False):
        self.includeInvisible = includeInvisible
        self.pids = {}
        wx.TreeCtrl.__init__(
            self,
            parent,
            -1,
            style=(
                wx.TR_DEFAULT_STYLE |
                wx.TR_HIDE_ROOT |
                wx.TR_FULL_ROW_HIGHLIGHT
            ),
            size=(-1, 150)
        )
        self.imageList = imageList = wx.ImageList(16, 16)
        imageList.Add(GetInternalBitmap("cwindow"))
        imageList.Add(GetInternalBitmap("cedit"))
        imageList.Add(GetInternalBitmap("cstatic"))
        imageList.Add(GetInternalBitmap("cbutton"))
        self.SetImageList(imageList)
        self.root = self.AddRoot("")

        # tree context menu
        def OnCmdHighlight(dummyEvent=None):
            hwnd = self.GetPyData(self.GetSelection())
            for _ in range(10):
                HighlightWindow(hwnd)
                sleep(0.1)
        menu = wx.Menu()
        menuId = wx.NewId()
        menu.Append(menuId, "Highlight")
        self.Bind(wx.EVT_MENU, OnCmdHighlight, id=menuId)
        self.contextMenu = menu

        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnItemRightClick)
        self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.OnItemExpanding)
        self.Bind(wx.EVT_TREE_ITEM_COLLAPSED, self.OnItemCollapsed)
        self.AppendPrograms() 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:40,代码来源:WindowTree.py

示例14: Destroy

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TreeCtrl [as 别名]
def Destroy(self):
        self.Unselect()
        self.imageList.Destroy()
        return wx.TreeCtrl.Destroy(self) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:6,代码来源:WindowTree.py

示例15: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import TreeCtrl [as 别名]
def __init__(self, parent, name, library, default=None):
        wx.Dialog.__init__(self,
                           name='BrowseValueDialog', parent=parent,
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
                           title=_('Browse %s values library') % name)

        self.staticText1 = wx.StaticText(
            label=_('Choose a value for %s:') % name,
            name='staticText1', parent=self,
            pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)

        self.ValuesLibrary = wx.TreeCtrl(
            name='ValuesLibrary', parent=self, pos=wx.Point(0, 0),
            size=wx.Size(400, 200),
            style=wx.TR_HAS_BUTTONS | wx.TR_SINGLE | wx.SUNKEN_BORDER | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT)

        self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)

        self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())

        self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10)

        self.flexGridSizer1.AddWindow(self.staticText1,   0, border=20, flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
        self.flexGridSizer1.AddWindow(self.ValuesLibrary, 0, border=20, flag=wx.GROW | wx.LEFT | wx.RIGHT)
        self.flexGridSizer1.AddSizer(self.ButtonSizer,    0, border=20, flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)

        self.flexGridSizer1.AddGrowableCol(0)
        self.flexGridSizer1.AddGrowableRow(1)

        self.SetSizer(self.flexGridSizer1)
        self.Fit()

        root = self.ValuesLibrary.AddRoot("")
        self.GenerateValuesLibraryBranch(root, library, default) 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:36,代码来源:BrowseValuesLibraryDialog.py


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