pyGTK, Buttons and Pixmaps problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fulko van Westrenen

    pyGTK, Buttons and Pixmaps problem


    Hello,

    I use pyGTK in a program with ToggleButton and Pixmap.
    The problem I try top solve is changing the pixmap for the
    two states of the button. Can it be done? (should be possible),
    and someone provide me with working code?

    The code I use now is (python-2.2, gtk-1.2):

    button = gtk.GtkToggleBu tton()
    button.connect( "clicked", do_my_thing)
    button.show()
    pix,mask = gtk.create_pixm ap_from_xpm(win dow,None,'nice. xpm')
    pixmap = gtk.GtkPixmap(p ix,mask)
    pixmap.show()
    button.add(pixm ap)


    Can someone tell me how to make it work?

    Thanks,
    Fulko


    --
    Fulko van Westrenen
    fwes@lina.dto.t udelft.nl
  • David M. Cook

    #2
    Re: pyGTK, Buttons and Pixmaps problem

    In article <slrnbscfk0.c1h .fulko@lina.dto .tudelft.nl>, Fulko van Westrenen
    wrote:
    [color=blue]
    > Hello,
    >
    > I use pyGTK in a program with ToggleButton and Pixmap.
    > The problem I try top solve is changing the pixmap for the
    > two states of the button. Can it be done? (should be possible),
    > and someone provide me with working code?
    >
    > The code I use now is (python-2.2, gtk-1.2):
    >
    > button = gtk.GtkToggleBu tton()
    > button.connect( "clicked", do_my_thing)[/color]

    For a toggle button, you want to handle the "toggle" signal. Also, for
    getting the icon to change between states I think you want to look at the
    IconSet and IconSource APIs:



    Dave Cook

    Comment

    • Fulko van Westrenen

      #3
      Re: pyGTK, Buttons and Pixmaps problem

      On Thu, 27 Nov 2003 19:21:57 GMT, David M. Cook <davecook@nowhe re.net> wrote:[color=blue]
      >In article <slrnbscfk0.c1h .fulko@lina.dto .tudelft.nl>, Fulko van Westrenen
      >wrote:[/color]
      [...][color=blue]
      >
      >For a toggle button, you want to handle the "toggle" signal.[/color]

      OK
      [color=blue]
      >Also, for
      >getting the icon to change between states I think you want to look at the
      >IconSet and IconSource APIs:
      >
      >http://www.gnome.org/~james/pygtk-do...tkiconset.html[/color]

      Dear Dave,
      Thank you for your hint. I read this forward and back again, but I can't
      figure how to apply this. Is there example-code somewhere that shows a
      changing image when pushing the button?
      Best,
      Fulko
      [color=blue]
      >
      >Dave Cook[/color]


      --
      Fulko van Westrenen

      Comment

      Working...