Home > database >  WXPython Event Handling - Button
WXPython Event Handling - Button

Time:09-22

When I'm running the following code, I received the error (image attached) I have a button called btn and when I add it to my right panel I cannot move its position, does anyone knows how can I do that? And another issue is that I'd like to call that specific button when I click on Big Script on the left panel, however I have no clue how to do this, I tried to put the button on the OnSelChanged method but I wasn't able to make it work.

The whole code is down below so it's easier to copy-paste it.

enter image description here

import wx
from wx.core import Font, Position, Size
import wx.lib.newevent
from wx.lib.agw.customtreectrl import CustomTreeCtrl

def onButton(event):
    print("Button Pressed")

#---------------------------------------------------------------------------

class MyTree(wx.TreeCtrl):
    """
    Our customized TreeCtrl class.
    """
    def __init__(self, parent, id, position, size, style):
        """
        Initialize our tree.
        """
        wx.TreeCtrl.__init__(self, parent, id, position, size, style)
       
        root = self.AddRoot('Programmer')
        
        os = self.AppendItem(root, '           
  • Related