Hey Guys
For all intensive purposes, an eventBox can have widgets packed into it
as I need and it can also have the background set as a style property
ala "bg_pixmap[NORMAL] = 'something.png'". My problem is that the
background needs to stretch, not tile. Like this:
http://www.ensomniac.com/pygtk/button_example3.jpg
When looking at the image above, please consider that I need to pack
widgets inside the blue graphic area. That is why I need to use some
form of container. I can't use an image widget, I can't use anything
that won't let me pack widgets inside the graphic area.
The reason I initially decided to go with a button was because I knew I
could skin it (it has advanced skinning functionality allowing you to
stretch the pixmap while leaving the borders of the graphic intact) and
it could act as a container for other widgets. The problem with using a
button is that each time you hover over the main container button, it
steals all of the events that I want to go to the child widgets. My
initial post was looking for ideas on how I could disable the main
button from events and just use it as a graphic container for my child
widgets which would still need to work as expected. This has proven to
be impossible?
Then you guys suggested using something else, like an eventBox. That's
fine, but as I pointed out above, I can't stretch my pixmap (to my
knowledge) it tiles by default. Since the widget container needs to be
dynamic, it will be changing in size and must look good as it repacks
and resizes (again, a button as a container is exactly what I need).
Here were my problems with using a button as a container (as opposed to
an eventBox):
http://www.ensomniac.com/pygtk/button_example2.jpg
http://www.ensomniac.com/pygtk/button_example.jpg
Another type of container that I have considered is a frame widget. A
frame widget would also be ideal because the outer borders can be
skinned and it acts as a normal gtk container widget. The problem is
that you can only skin the borders, there is no background function. I
could pack an eventBox into the frame and skin that, but then i'm back
to my same problem above where the texture would tile and not stretch.
Does this clear up my intentions?
Thanks for the support
Ryan
John Finlay wrote:
Ryan Martin wrote:
Hey John,
Thanks for the response. Yes, technically that would work, except
that you can't stretch the background of an event box. It only tiles.
As the style is applied to other sized event boxes, the background
texture would not stretch and resize.
If anybody knows a way to make the background pixmap for an event box
stretch, I'd be all set. Any ideas?
Thanks
Ryan
What do you mean by stretch and resize? An example would help to
visualize how this would work.
John Finlay wrote:
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
*
*
--
Ryan Martin
*Industrial Light + Magic
*Assistant Technical Director
cell: 973-632-1417 / desk: 415-746-2117
*
*
------------------------------------------------------------------------
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/
--
Ryan Martin
*Industrial Light + Magic
*Assistant Technical Director
cell: 973-632-1417 / desk: 415-746-2117
*
*
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/