[sugar] path + emulator
Marco Pesenti Gritti
mpg at redhat.com
Sat Apr 14 18:31:50 EDT 2007
On Sat, 2007-04-14 at 17:17 -0400, jjungcla at gsd.harvard.edu wrote:
> hi guys,
> two really basic questions we couldn't resolve in class this week:
> 1. Using Qemu as emulator on a PC, how do you move a file from Windows to
> the emulated file structure?
> 2. There is a problem with simply loading an image and displaying it on
> the screen using this code below (the image.png file sits right next to
> the application file). The application starts up but shows the
> file-not-found icon in the middle of the screen. How does sugar actually
> handle imgages?
> Thanks guys!
> Jan
>
>
> class TouchTyperActivity(activity.Activity):
>
> def hello(self, widget, data=None):
> logging.info('Image Load Activity')
> def __init__(self, handle):
> activity.Activity.__init__(self, handle)
> ROOT = os.path.dirname(os.path.abspath(__file__))
> self.image = gtk.Image()
> pixbuf = gtk.gdk.pixbuf_new_from_file(ROOT + "image.png")
This looks wrong, ROOT will not have a leading / and the resulting path
will be incorrect.
This should work better:
os.path.join(activity.get_bundle_path(), 'image.png')
Marco
More information about the Sugar
mailing list