Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I started developing an app using quickly which will target a raspberry pi board. I have created a single screen so far which contains a few buttons and labels. I run this on the board by doing a quickly package command on my system and then installing the package onto the board using dpkg command. Everything seemed to be working fine until i started adding images to my button widgets. What I'm trying to do is, in Glade, I'm setting a image child widget to appear onto a button widget. The included image is a .png file on my system. I then add the following line of code on my main.py file , to always show the image on the button along with the text.

self.mainwindow_bottombox.appliancesbutton.set_always_show_image(True)

This is working correctly on my development system which is running Linux Mint Olivia, but does not work on the pi board. In fact the application does not even start on the board. If I exclude the image adding part then the application works correctly on the board.I am not able to work out what the cause of this might be.

I would also like to add that a similar problem occurred earlier when trying to include a css file in my code for widget styling.

path = os.getcwd() + "/defaulttheme.css"
cssProvider = Gtk.CssProvider()
retval = cssProvider.load_from_path(path)
if retval:
   print "file loaded"
else:
   print "could not load file"            
Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), cssProvider,
                                     Gtk.STYLE_PROVIDER_PRIORITY_USER)

The above code to do widget styling using css file runs on my development system but not on the board but if i replace the above code by doing the following

css = Gtk.CssProvider() css.load_from_data('''

    GtkWindow{
        background: #2F3E51;
    }

    #toplevelgrid GtkButton{
        background: #3598DB;
    }
   ...............

This method works correctly on the board. Again no idea why this works and the earlier method does not..

Any help on this would be greatly appreciated.

share|improve this question
    
Leo21 -->> I forgot to mention, the pi board is running "Debian GNU/Linux 7.2" –  Leo21 Nov 11 '13 at 9:32
    
Ask UBUNTU. Ubuntu may be based on Debian, but it is not Debian... –  arochester Nov 11 '13 at 17:45
    
Leo21 ->> The error that i'm getting on the board while trying to include a image onto the button is " AttributeError: Button object has no attribute "set_always_show_image" ". This is due the the following line of code if have added to always display image::self.mainwindow_bottombox.appliancesbutton.set_always_show_image(True) ..But removing this piece of code never shows image on button if label is available. Any ideas how to solve this. –  Leo21 Nov 12 '13 at 11:05
    
Leo21---->>Was able to embed the image on button by doing the following: settings = Gtk.Settings.get_default() settings.props.gtk_button_images = True .... For the time being this seems to be only workaround i've to get my app working on the board. –  Leo21 Nov 12 '13 at 13:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.