[PyKDE] Can I creat a widget which can click and has a erose edge?

Matt Newell newellm at blur.com
Wed Mar 7 17:00:40 GMT 2007


On Wednesday 07 March 2007 02:08, Marco wrote:
> A QFrame seem can set a un-normal edge, but how to let it clickable?
>

import PyQt4.QtGui

class ClickableFrame( PyQt4.QtGui.QFrame ):
	def __init__(self,parent=None):
		PyQt4.QtGui.QFrame.__init__(self,parent)

	def mouseReleaseEvent( self, event ):
		print "Clicked!"


or if you want all the QPushButton stuff(clicked signals, etc), you could 
override the paintEvent, and just call PyQt4.QtGui.QFrame.paintEvent(self, 
event), so that it is drawn like a normal frame.

Matt




More information about the PyQt mailing list