add keyboard event to button in wxglade

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • agsupriya86
    New Member
    • Mar 2007
    • 34

    add keyboard event to button in wxglade

    How to add keyboard event to a button in wxglade??
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Originally posted by agsupriya86
    How to add keyboard event to a button in wxglade??
    Maybe you want to add a keyboard shortcut. Can you be more specific with your questions, please.

    Thanks for joining the Python Forum on TheScripts.com.

    Comment

    • agsupriya86
      New Member
      • Mar 2007
      • 34

      #3
      Originally posted by bartonc
      Maybe you want to add a keyboard shortcut. Can you be more specific with your questions, please.

      Thanks for joining the Python Forum on TheScripts.com.
      Actually i want to perform the action of the button on my frame by pressing enter from the keyboard and not clicking the button using mouse..im using wxglade with python 2.4..

      Comment

      • bartonc
        Recognized Expert Expert
        • Sep 2006
        • 6478

        #4
        Originally posted by agsupriya86
        Actually i want to perform the action of the button on my frame by pressing enter from the keyboard and not clicking the button using mouse..im using wxglade with python 2.4..
        Code:
        thisButton.SetDefault()
        aught to do the trick (where 'thisButton' is the name of the button you want clicked what you hit the enter key).

        Comment

        • agsupriya86
          New Member
          • Mar 2007
          • 34

          #5
          Originally posted by bartonc
          Code:
          thisButton.SetDefault()
          aught to do the trick (where 'thisButton' is the name of the button you want clicked what you hit the enter key).
          Im not getting where to add this code..in _init_ or in _set_properties function or in the action perform of button??

          Comment

          • bartonc
            Recognized Expert Expert
            • Sep 2006
            • 6478

            #6
            Originally posted by agsupriya86
            Im not getting where to add this code..in _init_ or in _set_properties function or in the action perform of button??
            I haven't use wxGlade in a long time. In Boa Constructor (or non-generated code), it goes in __init__().

            Comment

            • agsupriya86
              New Member
              • Mar 2007
              • 34

              #7
              Originally posted by bartonc
              I haven't use wxGlade in a long time. In Boa Constructor (or non-generated code), it goes in __init__().
              not working in any of the three function:(
              its syntax goes like this..self.butt on_1.SetDefault ()

              Comment

              • bartonc
                Recognized Expert Expert
                • Sep 2006
                • 6478

                #8
                Originally posted by agsupriya86
                not working in any of the three function:(
                its syntax goes like this..self.butt on_1.SetDefault ()
                Since you are using wxGlade, I'm wondering what version of wxPython you are using. The self.button_1.S etDefault() thing really should have worked.

                Comment

                • agsupriya86
                  New Member
                  • Mar 2007
                  • 34

                  #9
                  Originally posted by bartonc
                  Since you are using wxGlade, I'm wondering what version of wxPython you are using. The self.button_1.S etDefault() thing really should have worked.
                  im using python 2.4

                  Comment

                  • bartonc
                    Recognized Expert Expert
                    • Sep 2006
                    • 6478

                    #10
                    Originally posted by agsupriya86
                    im using python 2.4
                    wxPython is in 2.8.1. Last time I checked, wxGlade was behind by a few releases. That's the crutial version number that I was looking for.

                    Comment

                    Working...