Results 1 to 5 of 5

Thread: Python + Glade -- Changing an image filename

  1. #1
    Join Date
    Apr 2007
    Location
    Germany
    Beans
    75

    Python + Glade -- Changing an image filename

    Hello all


    I'm creating a little tool to change certain aspects of my new custom icon-theme, like branding, folders, etc. I decided this was a good project to start learning Python and PyGTK with it.

    I'm slowly understanding how Python works, it's a lot of fun to write it actually!

    I used Glade to create a user interface. I'm now at a point where I have a GtkImage somewhere, and I want to change the filename of the source image it uses. In other words: I want to set the image it displays through Python instead of Glade (because the image can change on certain events).

    Code:
    imgFuture = self.wTree.get_widget("BrandingFutureSVG")
    What method do I have to call on imgFuture in order to do this? Thanks

  2. #2
    Join Date
    Nov 2006
    Location
    Norway
    Beans
    795
    Distro
    Kubuntu 10.04 Lucid Lynx

    Re: Python + Glade -- Changing an image filename

    You can use:
    Code:
    filename = path-and-or-filename.png
    imgFuture.set_from_file(filename)
    Open mind, open source!
    Keep control of computer usage with timekpr
    Screensaver for Amarok? AmarokScreenSaver
    My (Norwegian) blog about motorcycles and MotoGP

  3. #3
    Join Date
    Apr 2007
    Location
    Germany
    Beans
    75

    Re: Python + Glade -- Changing an image filename

    Thanks! That worked!

    Is there any way I can find these methods myself? Is there a good documentation?

    For example, other things I am trying to archieve are:
    Extracting the filename from the widget
    Changing the items in a ComboBox

  4. #4
    Join Date
    Nov 2006
    Location
    Norway
    Beans
    795
    Distro
    Kubuntu 10.04 Lucid Lynx

    Re: Python + Glade -- Changing an image filename

    http://www.pygtk.org/

    Have a look under "Documentation".
    Open mind, open source!
    Keep control of computer usage with timekpr
    Screensaver for Amarok? AmarokScreenSaver
    My (Norwegian) blog about motorcycles and MotoGP

  5. #5
    Join Date
    Jun 2006
    Location
    Gwangju, Korea
    Beans
    3,479

    Re: Python + Glade -- Changing an image filename

    Quote Originally Posted by robz0rz View Post
    Is there any way I can find these methods myself? Is there a good documentation?
    Install DevHelp and the PyGTK doc package. DevHelp will then give you all that info.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •