Inserting image in a view

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Inserting image in a view

Boiteux, Benoit

Hello,

 

I would like to create a view with controls (buttons,…), and to help the user, I need to insert a picture container in the view (png, jpg…).

How can this be done with Traits ? other lib ?

 

Thanks

Benoit

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Enthought-Dev] Inserting image in a view

bryce hendrix-2
You can use either the ImageEditor (which I think is the standard editor for Image types), or if you've got a SVG, you can use the SVG Editor in the Enable package.

Bryce

On 01/27/2010 03:44 AM, Boiteux, Benoit wrote:

Hello,

 

I would like to create a view with controls (buttons,…), and to help the user, I need to insert a picture container in the view (png, jpg…).

How can this be done with Traits ? other lib ?

 

Thanks

Benoit

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
  
_______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Enthought-Dev] Inserting image in a view

Warren Weckesser
The Traits UI Demo includes an example of using an ImageEditor, in the
"Extras" section. I've attached another example. It displays an image
called "my_image.png" that it gets from the current directory. It also
has a couple gratuitous buttons.

Warren


bryce hendrix wrote:

> You can use either the ImageEditor (which I think is the standard
> editor for Image types), or if you've got a SVG, you can use the SVG
> Editor in the Enable package.
>
> Bryce
>
> On 01/27/2010 03:44 AM, Boiteux, Benoit wrote:
>>
>> Hello,
>>
>> I would like to create a view with controls (buttons,…), and to help
>> the user, I need to insert a picture container in the view (png, jpg…).
>>
>> How can this be done with Traits ? other lib ?
>>
>> Thanks
>>
>> Benoit
>>
>> ---------------------------------------------------------------------
>> Intel Corporation SAS (French simplified joint stock company)
>> Registered headquarters: "Les Montalets"- 2, rue de Paris,
>> 92196 Meudon Cedex, France
>> Registration Number:  302 456 199 R.C.S. NANTERRE
>> Capital: 4,572,000 Euros
>>
>> This e-mail and any attachments may contain confidential material for
>> the sole use of the intended recipient(s). Any review or distribution
>> by others is strictly prohibited. If you are not the intended
>> recipient, please contact the sender and delete all copies.
>>  
>>
>>
>> _______________________________________________
>> Enthought-Dev mailing list
>> [hidden email]
>> https://mail.enthought.com/mailman/listinfo/enthought-dev
>>  
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
>  


import os

from enthought.traits.api import HasTraits, Button
from enthought.traits.ui.api import Image, ImageEditor, View, HGroup, UItem, Label
from enthought.pyface.api import ImageResource


class Foo(HasTraits):
    """Demonstrate the use of Image, ImageResource and ImageEditor in a Traits UI view."""

    image = Image
   
    button1 = Button('Button 1')
    button2 = Button('Button 2')

    view = View(
            Label('Here is the image:'),
            UItem('image', editor=ImageEditor()),
            HGroup(
                UItem('button1'),
                UItem('button2'),
                ),
            resizable=True,
            )

    def _image_default(self):
        # Get the image from the current directory.
        path = os.path.curdir
        img = ImageResource(name='my_image.png', search_path=[path])
        return img
   
    def _button1_fired(self):
        print "You clicked Button 1."

    def _button2_fired(self):
        print "You clicked Button 2."


if __name__ == "__main__":
    f = Foo()
    f.configure_traits()
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Inserting image in a view

Boiteux, Benoit
Thanks a lot, that's perfect example !

Benoit

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Warren Weckesser
Sent: Thursday, January 28, 2010 1:41 AM
To: [hidden email]
Subject: Re: [Enthought-Dev] Inserting image in a view

The Traits UI Demo includes an example of using an ImageEditor, in the "Extras" section. I've attached another example. It displays an image called "my_image.png" that it gets from the current directory. It also has a couple gratuitous buttons.

Warren


bryce hendrix wrote:

> You can use either the ImageEditor (which I think is the standard
> editor for Image types), or if you've got a SVG, you can use the SVG
> Editor in the Enable package.
>
> Bryce
>
> On 01/27/2010 03:44 AM, Boiteux, Benoit wrote:
>>
>> Hello,
>>
>> I would like to create a view with controls (buttons,...), and to help
>> the user, I need to insert a picture container in the view (png, jpg...).
>>
>> How can this be done with Traits ? other lib ?
>>
>> Thanks
>>
>> Benoit
>>
>> ---------------------------------------------------------------------
>> Intel Corporation SAS (French simplified joint stock company)
>> Registered headquarters: "Les Montalets"- 2, rue de Paris,
>> 92196 Meudon Cedex, France
>> Registration Number:  302 456 199 R.C.S. NANTERRE
>> Capital: 4,572,000 Euros
>>
>> This e-mail and any attachments may contain confidential material for
>> the sole use of the intended recipient(s). Any review or distribution
>> by others is strictly prohibited. If you are not the intended
>> recipient, please contact the sender and delete all copies.
>>  
>>
>>
>> _______________________________________________
>> Enthought-Dev mailing list
>> [hidden email]
>> https://mail.enthought.com/mailman/listinfo/enthought-dev
>>  
>
> ----------------------------------------------------------------------
> --
>
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
>  

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Progress bar

Boiteux, Benoit
Hello,

I noticed the very good example on how to make a progress bar here:
http://blog.enthought.com/?p=94

In this example, the progress bar is in a pop-up window (and works well :) )

Is it possible to include a progress bar in a traits view to avoid a popup ?

Benoit
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Progress bar

bryce hendrix-2
A few months ago I added a ProgressEditor to Traits, which can be
embedded in a View. Here is email I sent to the list with an example:

http://article.gmane.org/gmane.comp.python.enthought.devel/20777/match=progresseditor

Maybe its time for another blog post...

bryce

On 01/29/2010 03:00 AM, Boiteux, Benoit wrote:

> Hello,
>
> I noticed the very good example on how to make a progress bar here:
> http://blog.enthought.com/?p=94
>
> In this example, the progress bar is in a pop-up window (and works well :) )
>
> Is it possible to include a progress bar in a traits view to avoid a popup ?
>
> Benoit
> ---------------------------------------------------------------------
> Intel Corporation SAS (French simplified joint stock company)
> Registered headquarters: "Les Montalets"- 2, rue de Paris,
> 92196 Meudon Cedex, France
> Registration Number:  302 456 199 R.C.S. NANTERRE
> Capital: 4,572,000 Euros
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
>
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
>    

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev