[Tkinter-discuss] Possible to stack frames with frame transparency? (create widget w/gradient background)

Igor Novikov igor.e.novikov at gmail.com
Wed Nov 3 22:51:08 CET 2010


On Wed, Nov 3, 2010 at 11:50 PM, Igor Novikov <igor.e.novikov at gmail.com>wrote:

>
>
> On Wed, Nov 3, 2010 at 8:55 PM, <python at bdurham.com> wrote:
>
>> New to Tkinter: Is it possible to stack frames on top of one another and
>> if so, can frames have transparency?
>>
>> My goal is to create widgets with gradient backgrounds. I was hoping I
>> could do this by placing an image in a frame and then placing an identical
>> sized frame over this image frame. This on-top frame would contain all my
>> child widgets.
>>
>> Details: Is it possible to place a frame on top of an image background?
>> From my reading, the only way to do this appears to be to use a Canvas as my
>> container (vs. a Frame). The downside to using a canvas appears to be that
>> Labels do not have transparent backgrounds so any text I place in such a
>> (canvas based) container must be placed with Canvas.create_text() vs. laid
>> out via one of the pack/grid/place layout managers. Am I understanding this
>> right?
>>
>> Thank you,
>> Malcolm
>>
>> _______________________________________________
>> Tkinter-discuss mailing list
>> Tkinter-discuss at python.org
>> http://mail.python.org/mailman/listinfo/tkinter-discuss
>>
>>
>
> I think this could be helpful for you:
>
> http://saveimg.ru/pictures/04-11-10/12d35ff67732239776ca2dfe7a483d30.png
>
> This is tkCairo extension in work. You can find the code in our repository:
>
> http://sk1.svn.sourceforge.net/viewvc/sk1/trunk/subprojects/tkCairo/
>
> tkCairo is modified pycairo project for tk widgetset. So you can use
> pycairo docs
> as a cairo command reference. Please note we have implemented Linux support
> only.
> But this extension can be easy adopted for win32.
>
> Concerning tk Frame stacking you can try using place() manager. All tk
> widgets are
> native windows without WM decorations. So you can apply all toplevel
> methods
> to widgets if they managed by place() manager.
>
> --
> Regards,
>
> Igor Novikov
> sK1 Project
> http://sk1project.org
>
>
>
Small addition: tkCairo allows drawing on regular tk Frame widget and you
can pack in this
Frame any other child widget (on screenshot tk Button is packed into such
frame).

-- 
Regards,

Igor Novikov
sK1 Project
http://sk1project.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20101103/0d155826/attachment-0001.html>


More information about the Tkinter-discuss mailing list