[pygtk] Disable signals and events to use a button as a container, not as a button?
John Finlay
finlay at moeraki.com
Sat Sep 5 11:04:50 WST 2009
Have you tried using an eventbox inside the frame to hold the vbox that
holds the other stuff? I believe that the purpose of the eventbox is to
do just the kind of thing you want i.e. set the bg_pixmap for the
eventbox to some custom pixmap that represents your style.
John
Ryan Martin wrote:
> That's a good question. I didn't explain why I needed to do this
> because I thought I'd confuse more. In the software I'm writing, I'm
> combining theme elements with some widget tricks to accomplish a
> visual task that I don't know is possible by any other means.
>
> I need to have a container than I can 'skin' that can contain other
> widgets. My initial thought was to theme gtk.Frame to have borders and
> a background (like a button), and I can pack all of my widgets into
> that. Unfortunately, to my knowledge, you can't have a background on a
> frame widget. So I started cycling through other gtk widgets to see if
> there was some sort of container that I could theme, but was unable to
> find something that worked.
>
>
> (http://www.ensomniac.com/pygtk/button_example2.jpg)
>
> That led me to my latest theory, that if I were able to use a button
> as a container, I could theme gtk.Button to get the visual style I
> wanted, but also the functionality of having the widgets inside. I
> would need to disable the core button (container) from receiving and
> processing signals, but somehow pass them on to any of the widgets
> inside the button:
>
>
> (http://www.ensomniac.com/pygtk/button_example.jpg)
>
> And that leaves me where I'm at now. The following code will disable
> my base button from working:
> *print* self.widgets.main_container_button.get_property("above-child")
> >> *False**
> print* self.widgets.main_container_button.set_property("above-child", True)
> *print* self.widgets.main_container_button.get_property("above-child")
> >> *True*
> But I have no idea how to pass the events to the widgets that are
> children of the button (the 'button_2' widget and the "entry" widget
> in the image above).
>
> If there is some other way to accomplish my task, I'm all ears.
> Currently, I'm struggling trying to get my events passed to the child
> widgets.
>
>
> Thanks for the help!
>
> Ryan
>
>
>
>
>
>
>
>
> John Finlay wrote:
>> Ryan Martin wrote:
>>> Hey Guys,
>>> I have a strange situation that I'm having trouble finding a
>>> solution for. In the application I'm building, I would like to use a
>>> button as a container and not necessarily a button. Currently, I
>>> have a text field and another button inside my main button in
>>> question. What I would like is to disable all of the innate
>>> callbacks (prelight/hover, clicked, etc.) on that main button and
>>> just have it sit there while still being able to click the child
>>> button inside the main button or enter text into the text field.
>>>
>>> One thing to consider is that I need to disable callbacks on the
>>> main button but not on any of the widgets that are added to the main
>>> button as a child.
>>>
>>> Is this possible? Did that make sense?
>>>
>>> Any help would be greatly appreciated. I have scoured through old
>>> threads looking for clues.
>> Why do you need to use a button as a container when you don't want to
>> use any of the button's features? Are there no GTK containers that work?
>>
>> John
>>
>
> --
> Ryan Martin
> *Industrial Light + Magic
> *Assistant Technical Director
> cell: 973-632-1417 / desk: 415-746-2117
>
> *
> *
More information about the pygtk
mailing list