hi everyone
im making a transparent window. look pretty cool (python gtk cairo)
i added some buttons and they look very ugly
so add just images instead buttons, look grate again,even the animated and transparent images look ok, but image don't have "clicked" events
then put images into eventbox, work, but a rectangle surround the image, eventbox is not transparent
there is some way to make them transparent?
i lend here an example script and a image. hope some one can help me =3 -
import sys
-
import gobject
-
import pango
-
sys.path[:0] = ['/usr/local/lib/python2.4/site-packages/gtk-2.0']
-
import pygtk
-
pygtk.require('2.0')
-
import gtk
-
from gtk import gdk
-
import cairo
-
-
if gtk.pygtk_version < (2,9,0):
-
print "PyGtk 2.9.0 or later required"
-
raise SystemExit
-
supports_alpha = False
-
-
def ejemplo(widget,event,data="....."):
-
print data
-
-
def expose(widget, event):
-
global supports_alpha
-
-
cr = widget.window.cairo_create()
-
-
if supports_alpha == True:
-
cr.set_source_rgba(0, 0, 0, 0.6) # Transparent
-
else:
-
cr.set_source_rgb(1.0, 1.0, 1.0) # Opaque white
-
-
# Draw the background
-
cr.set_operator(cairo.OPERATOR_SOURCE)
-
cr.paint()
-
-
cr.fill()
-
cr.stroke()
-
return False
-
-
def screen_changed(widget, old_screen=None):
-
-
global supports_alpha
-
-
# To check if the display supports alpha channels, get the colormap
-
screen = widget.get_screen()
-
colormap = screen.get_rgba_colormap()
-
if colormap == None:
-
print 'Your screen does not support alpha channels!'
-
colormap = screen.get_rgb_colormap()
-
supports_alpha = False
-
else:
-
print 'Your screen supports alpha channels!'
-
supports_alpha = True
-
-
# Now we have a colormap appropriate for the screen, use it
-
widget.set_colormap(colormap)
-
-
return False
-
-
def main(args):
-
win = gtk.Window()
-
-
win.set_title('Alpha Demo')
-
win.connect('delete-event', gtk.main_quit)
-
win.set_app_paintable(True)
-
win.connect('expose-event', expose)
-
win.connect('screen-changed', screen_changed)
-
win.set_decorated(True)
-
win.add_events(gdk.BUTTON_PRESS_MASK)
-
win.set_default_size(920,460)
-
#win.connect('button-press-event', clicked)
-
screen_changed(win)
-
hbox = gtk.HBox(False,0)
-
ima = gtk.Image()
-
ima.set_from_file("folder_orange_open.png")
-
bot = gtk.Button()
-
bot.connect("clicked",ejemplo,"folder_orange_open.png")
-
bot.add(ima)
-
hbox.pack_start(bot,False,False,20)
-
-
ima2 = gtk.Image()
-
ima2.set_from_file("folder_orange_open.png")
-
hbox.pack_start(ima2,False,False,20)
-
-
ima3 = gtk.Image()
-
ima3.set_from_file("folder_orange_open.png")
-
e = gtk.EventBox()
-
e.add(ima3)
-
e.connect("button_press_event",ejemplo,"eventbox")
-
hbox.pack_start(e,False,False,20)
-
-
-
vbox = gtk.VBox(False,0)
-
vbox.pack_start(hbox,False,True,50)
-
win.add(vbox)
-
win.show_all()
-
gtk.main()
-
-
return True
-
-
if __name__ == '__main__':
-
sys.exit(main(sys.argv))
-
-
0 1732 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: joe |
last post by:
I have a 50% transparent window that is on top of the
desktop. I want the user to be able to click 'Through the
transparent window' onto objects behind it ... my computer.
The transparent window does not need force it just needs
to be ontop of all the other windows.
another example is .. if you press alt-ctrl-del to bring
up task manager how can i program the window to pass mouse
clicks on it to the window behined it, if task manger...
|
by: Never Best |
last post by:
hello, I was curious if someone here could help... I basically want to put
a transparent window infront of a fullscreen application and keep drawing
text onto the transparent window (basically the transparent window wont
affect the fullscreen application in anyway, just use to display
information).
The fullscreen application is an external program. I've tried using the
"setTopMost" but it only puting the window I created above all the...
|
by: Wolfgang |
last post by:
Is it possible in C# .NET to create a window that is always on top of
all other windows, while at the same time being partially transparent?
If not in C# .NET, how about in C++ .NET?
As an example that this kind of thing is possible, the splash screen
of Adobe Reader (formely Acrobat) seems to be partially transparent.
If you have a code snippet of how something like this could be done,
that would be great.
|
by: Max |
last post by:
Hello Everyone,
I have written a VB.NET application that uses a
transparent panel. I display various forms and one
external COM application in my transparent panel (one at
a time). When I resize my panel or change its location,
then theform or application that fills the transparent
panel resizes or moves as needed.
However, I have a problem when a user selects another
|
by: Wolfgang |
last post by:
Is it possible in VB .NET to create a window that is always on top of
all other windows, while at the same time being partially transparent?
As example that this kind of thing is possible, the splash screen of
Adobe Reader (formely Acrobat) seems to be partially transparent.
If you have a code snippet of how something like this could be done,
that would be great.
Thanks,
| |
by: ShurikAg |
last post by:
Hi,
I have this kind of class:
// SplashWnd.cpp : implementation of the CSplashWnd class
//
/////////////////////////////////////////////////////////////////////////////
|
by: yuban |
last post by:
I am trying ( so far in vain ) to display a normal looking ( non-transparent ) control in a transparent window. I am attempting this in C++, on Vista ( argh ), and having no luck at all. Our transparent window has been accomplished with the infamous "DwmExtendFrameIntoClientArea()" call, which of course implies that "composition" is enabled.
If someone can tell me how to simply render an icon or bitmap so that it is not see-through, I would...
|
by: TS |
last post by:
I am losing my colgroup html element of a table that i toggle back and forth
of being visible=true/false. is there any workaround since the rendered html
doesn't contain it even though it has not been explicitely been made
invisible?
note also that even when the table is made visible=true, colgroup still
doesn't show up
|
by: Terry |
last post by:
Hi again folks,
After getting my page (http://theamazing.onlinewebshop.net/spotlight/)
to work in Firefox and Safari.
I thought I would try to get in working in IE.
My attempt is here: http://theamazing.onlinewebshop.net/light/
Unfortunately, the transparent window is not enclosing the mouse
|
by: ranpelt |
last post by:
Hi folks,
After getting my page (http://theamazing.onlinewebshop.net/spotlight/) to work in Firefox and Safari.
I thought I would try to get in working in IE.
My attempt is here: http://theamazing.onlinewebshop.net/light/
Unfortunately, the transparent window is not enclosing the mouse position when the mouse is over the image.
Also, the transparent window is jumping around.
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |