473,749 Members | 2,626 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

made a eventbox invisible in a transparent window??

1 New Member
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

Expand|Select|Wrap|Line Numbers
  1. import sys
  2. import gobject
  3. import pango
  4. sys.path[:0] = ['/usr/local/lib/python2.4/site-packages/gtk-2.0']
  5. import pygtk
  6. pygtk.require('2.0')
  7. import gtk
  8. from gtk import gdk
  9. import cairo
  10.  
  11. if gtk.pygtk_version < (2,9,0):
  12.     print "PyGtk 2.9.0 or later required"
  13.     raise SystemExit
  14. supports_alpha = False
  15.  
  16. def ejemplo(widget,event,data="....."):
  17.     print data
  18.  
  19. def expose(widget, event):
  20.     global supports_alpha
  21.  
  22.     cr = widget.window.cairo_create()
  23.  
  24.     if supports_alpha == True:
  25.         cr.set_source_rgba(0, 0, 0, 0.6) # Transparent
  26.     else:
  27.         cr.set_source_rgb(1.0, 1.0, 1.0) # Opaque white
  28.  
  29.     # Draw the background
  30.     cr.set_operator(cairo.OPERATOR_SOURCE)
  31.     cr.paint()
  32.  
  33.     cr.fill()
  34.     cr.stroke()
  35.     return False
  36.  
  37. def screen_changed(widget, old_screen=None):
  38.  
  39.     global supports_alpha
  40.  
  41.     # To check if the display supports alpha channels, get the colormap
  42.     screen = widget.get_screen()
  43.     colormap = screen.get_rgba_colormap()
  44.     if colormap == None:
  45.         print 'Your screen does not support alpha channels!'
  46.         colormap = screen.get_rgb_colormap()
  47.         supports_alpha = False
  48.     else:
  49.         print 'Your screen supports alpha channels!'
  50.         supports_alpha = True
  51.  
  52.     # Now we have a colormap appropriate for the screen, use it
  53.     widget.set_colormap(colormap)
  54.  
  55.     return False
  56.  
  57. def main(args):
  58.     win = gtk.Window()
  59.  
  60.     win.set_title('Alpha Demo')
  61.     win.connect('delete-event', gtk.main_quit)
  62.     win.set_app_paintable(True)
  63.     win.connect('expose-event', expose)
  64.     win.connect('screen-changed', screen_changed)
  65.     win.set_decorated(True)
  66.     win.add_events(gdk.BUTTON_PRESS_MASK)
  67.     win.set_default_size(920,460) 
  68.     #win.connect('button-press-event', clicked)    
  69.     screen_changed(win)
  70.     hbox = gtk.HBox(False,0)
  71.     ima = gtk.Image()
  72.     ima.set_from_file("folder_orange_open.png")
  73.     bot = gtk.Button()
  74.     bot.connect("clicked",ejemplo,"folder_orange_open.png")
  75.     bot.add(ima)
  76.     hbox.pack_start(bot,False,False,20)
  77.  
  78.     ima2 = gtk.Image()
  79.     ima2.set_from_file("folder_orange_open.png")
  80.     hbox.pack_start(ima2,False,False,20)
  81.  
  82.     ima3 = gtk.Image()
  83.     ima3.set_from_file("folder_orange_open.png")
  84.     e = gtk.EventBox()
  85.     e.add(ima3)
  86.     e.connect("button_press_event",ejemplo,"eventbox")
  87.     hbox.pack_start(e,False,False,20)
  88.  
  89.  
  90.     vbox = gtk.VBox(False,0)
  91.     vbox.pack_start(hbox,False,True,50)    
  92.     win.add(vbox)
  93.     win.show_all()
  94.     gtk.main()
  95.  
  96.     return True
  97.  
  98. if __name__ == '__main__':
  99.     sys.exit(main(sys.argv))    
  100.  
  101.  
Attached Images
File Type: png folder_orange_open.png (3.2 KB, 152 views)
Aug 26 '12 #1
0 1737

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2684
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...
0
1500
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...
3
1921
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.
0
963
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
3
3039
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,
1
3135
by: ShurikAg | last post by:
Hi, I have this kind of class: // SplashWnd.cpp : implementation of the CSplashWnd class // /////////////////////////////////////////////////////////////////////////////
1
2528
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...
4
3215
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
1
1914
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
1
1432
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.
0
8833
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9389
jinu1996
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...
1
9335
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,...
0
9256
tracyyun
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...
0
8257
agi2029
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...
1
6801
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4881
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3320
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2218
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.