Traits View Padding

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

Traits View Padding

Nicholas Earl
Hello everyone,

I'm having an issue where the GUI elements is a dialogue window are really close to the edges. I can't seem to find any way to set a window or View padding to keep elements away from the edges. Is there any such setting?

Thanks!

Nicholas Earl
Graduate Teaching Associate
San Diego State University

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

Re: Traits View Padding

Jaidev Deshpande
On Wed, May 29, 2013 at 12:21 AM, Nicholas Earl <[hidden email]> wrote:

> Hello everyone,
>
> I'm having an issue where the GUI elements is a dialogue window are really
> close to the edges. I can't seem to find any way to set a window or View
> padding to keep elements away from the edges. Is there any such setting?
>
> Thanks!
>
> Nicholas Earl
> Graduate Teaching Associate
> San Diego State University
>
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
>


Hi,

The Item object in TraitsUI has an attribute called `padding` which
can be used to specify the padding of a widget in pixels.

Check this out http://docs.enthought.com/traitsui/traitsui_user_manual/view.html?highlight=padding#the-item-object

HTH

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

Re: Traits View Padding

Nicholas Earl
Thanks for the reply.

I was aware that both Group and the Item objects have padding attributes, but they seem to have no effect on the dialogue box. For instance, the first element I have is a file selector box. It is flush to the left edge of the dialogue box regardless if I set the Item's padding or the Group's padding.

Could something be interfering?

Thanks again.

Nicholas Earl
Graduate Teaching Associate
San Diego State University


On Tue, May 28, 2013 at 11:59 AM, Jaidev Deshpande <[hidden email]> wrote:
On Wed, May 29, 2013 at 12:21 AM, Nicholas Earl <[hidden email]> wrote:
> Hello everyone,
>
> I'm having an issue where the GUI elements is a dialogue window are really
> close to the edges. I can't seem to find any way to set a window or View
> padding to keep elements away from the edges. Is there any such setting?
>
> Thanks!
>
> Nicholas Earl
> Graduate Teaching Associate
> San Diego State University
>
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
>


Hi,

The Item object in TraitsUI has an attribute called `padding` which
can be used to specify the padding of a widget in pixels.

Check this out http://docs.enthought.com/traitsui/traitsui_user_manual/view.html?highlight=padding#the-item-object

HTH

--
JD
_______________________________________________
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: Traits View Padding

Jaidev Deshpande
On Wed, May 29, 2013 at 12:45 AM, Nicholas Earl <[hidden email]> wrote:
> Thanks for the reply.
>
> I was aware that both Group and the Item objects have padding attributes,
> but they seem to have no effect on the dialogue box. For instance, the first
> element I have is a file selector box. It is flush to the left edge of the
> dialogue box regardless if I set the Item's padding or the Group's padding.
>
> Could something be interfering?

Could you share the code?

Thanks

>
> Thanks again.
>
> Nicholas Earl
> Graduate Teaching Associate
> San Diego State University
>
>
> On Tue, May 28, 2013 at 11:59 AM, Jaidev Deshpande
> <[hidden email]> wrote:
>>
>> On Wed, May 29, 2013 at 12:21 AM, Nicholas Earl <[hidden email]>
>> wrote:
>> > Hello everyone,
>> >
>> > I'm having an issue where the GUI elements is a dialogue window are
>> > really
>> > close to the edges. I can't seem to find any way to set a window or View
>> > padding to keep elements away from the edges. Is there any such setting?
>> >
>> > Thanks!
>> >
>> > Nicholas Earl
>> > Graduate Teaching Associate
>> > San Diego State University
>> >
>> > _______________________________________________
>> > Enthought-Dev mailing list
>> > [hidden email]
>> > https://mail.enthought.com/mailman/listinfo/enthought-dev
>> >
>>
>>
>> Hi,
>>
>> The Item object in TraitsUI has an attribute called `padding` which
>> can be used to specify the padding of a widget in pixels.
>>
>> Check this out
>> http://docs.enthought.com/traitsui/traitsui_user_manual/view.html?highlight=padding#the-item-object
>>
>> HTH
>>
>> --
>> JD
>> _______________________________________________
>> 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
>



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

Re: Traits View Padding

Nicholas Earl
You can find the UI code here (it's not connected to anything currently): http://pastebin.com/y01NBbuu

Thanks.

Nicholas Earl
Graduate Teaching Associate
San Diego State University


On Tue, May 28, 2013 at 12:19 PM, Jaidev Deshpande <[hidden email]> wrote:
On Wed, May 29, 2013 at 12:45 AM, Nicholas Earl <[hidden email]> wrote:
> Thanks for the reply.
>
> I was aware that both Group and the Item objects have padding attributes,
> but they seem to have no effect on the dialogue box. For instance, the first
> element I have is a file selector box. It is flush to the left edge of the
> dialogue box regardless if I set the Item's padding or the Group's padding.
>
> Could something be interfering?

Could you share the code?

Thanks

>
> Thanks again.
>
> Nicholas Earl
> Graduate Teaching Associate
> San Diego State University
>
>
> On Tue, May 28, 2013 at 11:59 AM, Jaidev Deshpande
> <[hidden email]> wrote:
>>
>> On Wed, May 29, 2013 at 12:21 AM, Nicholas Earl <[hidden email]>
>> wrote:
>> > Hello everyone,
>> >
>> > I'm having an issue where the GUI elements is a dialogue window are
>> > really
>> > close to the edges. I can't seem to find any way to set a window or View
>> > padding to keep elements away from the edges. Is there any such setting?
>> >
>> > Thanks!
>> >
>> > Nicholas Earl
>> > Graduate Teaching Associate
>> > San Diego State University
>> >
>> > _______________________________________________
>> > Enthought-Dev mailing list
>> > [hidden email]
>> > https://mail.enthought.com/mailman/listinfo/enthought-dev
>> >
>>
>>
>> Hi,
>>
>> The Item object in TraitsUI has an attribute called `padding` which
>> can be used to specify the padding of a widget in pixels.
>>
>> Check this out
>> http://docs.enthought.com/traitsui/traitsui_user_manual/view.html?highlight=padding#the-item-object
>>
>> HTH
>>
>> --
>> JD
>> _______________________________________________
>> 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
>



--
JD
_______________________________________________
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: Traits View Padding

Nicholas Earl
I still cannot figure out why the padding settings do not work. If anyone has any other ideas, I would greatly appreciate it!

Thanks,

Nicholas Earl
Graduate Teaching Associate
San Diego State University


On Tue, May 28, 2013 at 12:23 PM, Nicholas Earl <[hidden email]> wrote:
You can find the UI code here (it's not connected to anything currently): http://pastebin.com/y01NBbuu

Thanks.

Nicholas Earl
Graduate Teaching Associate
San Diego State University


On Tue, May 28, 2013 at 12:19 PM, Jaidev Deshpande <[hidden email]> wrote:
On Wed, May 29, 2013 at 12:45 AM, Nicholas Earl <[hidden email]> wrote:
> Thanks for the reply.
>
> I was aware that both Group and the Item objects have padding attributes,
> but they seem to have no effect on the dialogue box. For instance, the first
> element I have is a file selector box. It is flush to the left edge of the
> dialogue box regardless if I set the Item's padding or the Group's padding.
>
> Could something be interfering?

Could you share the code?

Thanks

>
> Thanks again.
>
> Nicholas Earl
> Graduate Teaching Associate
> San Diego State University
>
>
> On Tue, May 28, 2013 at 11:59 AM, Jaidev Deshpande
> <[hidden email]> wrote:
>>
>> On Wed, May 29, 2013 at 12:21 AM, Nicholas Earl <[hidden email]>
>> wrote:
>> > Hello everyone,
>> >
>> > I'm having an issue where the GUI elements is a dialogue window are
>> > really
>> > close to the edges. I can't seem to find any way to set a window or View
>> > padding to keep elements away from the edges. Is there any such setting?
>> >
>> > Thanks!
>> >
>> > Nicholas Earl
>> > Graduate Teaching Associate
>> > San Diego State University
>> >
>> > _______________________________________________
>> > Enthought-Dev mailing list
>> > [hidden email]
>> > https://mail.enthought.com/mailman/listinfo/enthought-dev
>> >
>>
>>
>> Hi,
>>
>> The Item object in TraitsUI has an attribute called `padding` which
>> can be used to specify the padding of a widget in pixels.
>>
>> Check this out
>> http://docs.enthought.com/traitsui/traitsui_user_manual/view.html?highlight=padding#the-item-object
>>
>> HTH
>>
>> --
>> JD
>> _______________________________________________
>> 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
>



--
JD
_______________________________________________
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: Traits View Padding

Pietro Berkes
Hi Nicholas,

I'm not sure why the padding is ignored, either. It has something to do with the group being at the very top of the view, as if you add it later is works fine.

A quick workaround is to define spacer elements manually:

    view = View(
        Group(
            Group(
                Item('10'),
                Group(
                    Item('10'),
                    Item('file_select', label="Select list", show_label=False, padding=10),
                    Item('load_file', show_label=False),
                    orientation='horizontal',
                    padding=15
                ),
                orientation='vertical',
            ),
            # etc.
      )


Also notice that the 'enthought' namespace has been deprecated:

from traits.api import *
from traitsui.api import View, Item, Group

Best,
Pietro



On Thu, May 30, 2013 at 2:26 AM, Nicholas Earl <[hidden email]> wrote:
I still cannot figure out why the padding settings do not work. If anyone has any other ideas, I would greatly appreciate it!

Thanks,

Nicholas Earl
Graduate Teaching Associate
San Diego State University


On Tue, May 28, 2013 at 12:23 PM, Nicholas Earl <[hidden email]> wrote:
You can find the UI code here (it's not connected to anything currently): http://pastebin.com/y01NBbuu

Thanks.

Nicholas Earl
Graduate Teaching Associate
San Diego State University


On Tue, May 28, 2013 at 12:19 PM, Jaidev Deshpande <[hidden email]> wrote:
On Wed, May 29, 2013 at 12:45 AM, Nicholas Earl <[hidden email]> wrote:
> Thanks for the reply.
>
> I was aware that both Group and the Item objects have padding attributes,
> but they seem to have no effect on the dialogue box. For instance, the first
> element I have is a file selector box. It is flush to the left edge of the
> dialogue box regardless if I set the Item's padding or the Group's padding.
>
> Could something be interfering?

Could you share the code?

Thanks

>
> Thanks again.
>
> Nicholas Earl
> Graduate Teaching Associate
> San Diego State University
>
>
> On Tue, May 28, 2013 at 11:59 AM, Jaidev Deshpande
> <[hidden email]> wrote:
>>
>> On Wed, May 29, 2013 at 12:21 AM, Nicholas Earl <[hidden email]>
>> wrote:
>> > Hello everyone,
>> >
>> > I'm having an issue where the GUI elements is a dialogue window are
>> > really
>> > close to the edges. I can't seem to find any way to set a window or View
>> > padding to keep elements away from the edges. Is there any such setting?
>> >
>> > Thanks!
>> >
>> > Nicholas Earl
>> > Graduate Teaching Associate
>> > San Diego State University
>> >
>> > _______________________________________________
>> > Enthought-Dev mailing list
>> > [hidden email]
>> > https://mail.enthought.com/mailman/listinfo/enthought-dev
>> >
>>
>>
>> Hi,
>>
>> The Item object in TraitsUI has an attribute called `padding` which
>> can be used to specify the padding of a widget in pixels.
>>
>> Check this out
>> http://docs.enthought.com/traitsui/traitsui_user_manual/view.html?highlight=padding#the-item-object
>>
>> HTH
>>
>> --
>> JD
>> _______________________________________________
>> 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
>



--
JD
_______________________________________________
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




--
Pietro Berkes
Scientific software developer
Enthought UK


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

Re: Traits View Padding

Nicholas Earl
Thanks Pietro, this does seem to fix the issue!

Nicholas Earl
Graduate Teaching Associate
San Diego State University


On Thu, May 30, 2013 at 12:59 AM, Pietro Berkes <[hidden email]> wrote:
Hi Nicholas,

I'm not sure why the padding is ignored, either. It has something to do with the group being at the very top of the view, as if you add it later is works fine.

A quick workaround is to define spacer elements manually:

    view = View(
        Group(
            Group(
                Item('10'),
                Group(
                    Item('10'),
                    Item('file_select', label="Select list", show_label=False, padding=10),
                    Item('load_file', show_label=False),
                    orientation='horizontal',
                    padding=15
                ),
                orientation='vertical',
            ),
            # etc.
      )


Also notice that the 'enthought' namespace has been deprecated:

from traits.api import *
from traitsui.api import View, Item, Group

Best,
Pietro



On Thu, May 30, 2013 at 2:26 AM, Nicholas Earl <[hidden email]> wrote:
I still cannot figure out why the padding settings do not work. If anyone has any other ideas, I would greatly appreciate it!

Thanks,

Nicholas Earl
Graduate Teaching Associate
San Diego State University


On Tue, May 28, 2013 at 12:23 PM, Nicholas Earl <[hidden email]> wrote:
You can find the UI code here (it's not connected to anything currently): http://pastebin.com/y01NBbuu

Thanks.

Nicholas Earl
Graduate Teaching Associate
San Diego State University


On Tue, May 28, 2013 at 12:19 PM, Jaidev Deshpande <[hidden email]> wrote:
On Wed, May 29, 2013 at 12:45 AM, Nicholas Earl <[hidden email]> wrote:
> Thanks for the reply.
>
> I was aware that both Group and the Item objects have padding attributes,
> but they seem to have no effect on the dialogue box. For instance, the first
> element I have is a file selector box. It is flush to the left edge of the
> dialogue box regardless if I set the Item's padding or the Group's padding.
>
> Could something be interfering?

Could you share the code?

Thanks

>
> Thanks again.
>
> Nicholas Earl
> Graduate Teaching Associate
> San Diego State University
>
>
> On Tue, May 28, 2013 at 11:59 AM, Jaidev Deshpande
> <[hidden email]> wrote:
>>
>> On Wed, May 29, 2013 at 12:21 AM, Nicholas Earl <[hidden email]>
>> wrote:
>> > Hello everyone,
>> >
>> > I'm having an issue where the GUI elements is a dialogue window are
>> > really
>> > close to the edges. I can't seem to find any way to set a window or View
>> > padding to keep elements away from the edges. Is there any such setting?
>> >
>> > Thanks!
>> >
>> > Nicholas Earl
>> > Graduate Teaching Associate
>> > San Diego State University
>> >
>> > _______________________________________________
>> > Enthought-Dev mailing list
>> > [hidden email]
>> > https://mail.enthought.com/mailman/listinfo/enthought-dev
>> >
>>
>>
>> Hi,
>>
>> The Item object in TraitsUI has an attribute called `padding` which
>> can be used to specify the padding of a widget in pixels.
>>
>> Check this out
>> http://docs.enthought.com/traitsui/traitsui_user_manual/view.html?highlight=padding#the-item-object
>>
>> HTH
>>
>> --
>> JD
>> _______________________________________________
>> 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
>



--
JD
_______________________________________________
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




--
Pietro Berkes
Scientific software developer
Enthought UK


_______________________________________________
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