Hello!
I tried to connect a wxEVT_RIGHT_DOWN with an wxToolbar.
My code is working perfectly well under MSWindows but it fails under
Linux/gtk. Is this a bug or is this not possible under wxgtk?
Thank you for any Help.
here is an example
···
----
from wxPython.wx import *
import cPickle, zlib
def getFile_EmptyData():
return cPickle.loads(zlib.decompress(
'x\xda\xcd\x8a!\x0e\x800\x0cE=\xa7h\x82\x18\xaaa\x022\r\xc9$\x13\x98YBP\x10\
\xca\xfd\x15\xed\x06c\x81\x0b\xf0~\xcd\xfb\xfd\xd5v\xe8bT\xba\x05\xbe\x06\
\xb4*\xa6Q9\x98\xa1\xdb\xa6y\rFle_K\x82\xa3\xb8\xa9%\xc1\x81}\xa0}\t\xe2\xe5\
i\x8d\xed\xad\x89OL\x80p\x95\xfe\x820/)\x86<\xe6\xcb\xd8:\xe6\xb3\xe4\xad\
\xfb,9\xbf^\xd2C*]\xce]\xbe\xe0\x12O\xc4\x9fq\x1e' ))
def getFile_EmptyBitmap():
return wxBitmapFromXPMData(getFile_EmptyData())
class MyApp(wxApp):
def OnInit(self):
self.main = MyFrame(None)
self.main.Show(true)
self.SetTopWindow(self.main)
return true
class MyFrame(wxFrame):
def __init__(self, prnt):
wxFrame.__init__(self, id = -1, name = '', parent = prnt, pos =
wxPoint(279, 263), size = wxSize(683, 445), style = wxDEFAULT_FRAME_STYLE,
title = 'MyFrame')
self.toolBar = MyToolBar(self)
self.SetToolBar(self.toolBar)
self.CreateStatusBar()
class MyToolBar(wxToolBar):
def __init__(self, prnt):
wxToolBar.__init__(self, id = wxNewId(), parent = prnt, pos =
wxDefaultPosition, size = wxDefaultSize, style = wxTB_HORIZONTAL | wxTB_FLAT,
name = '')
self.AddSimpleTool( 10, getFile_EmptyBitmap(), "New", "Long help for
'New'")
EVT_TOOL(self, 10, self.OnToolClick)
EVT_RIGHT_DOWN(self, self.OnRClick)
self.Realize()
def OnToolClick(self, event):
self.DoDialog("OnToolClick Dialog")
def OnRClick(self, event):
self.DoDialog("OnRClick Dialog")
def DoDialog(self, text="wxDialog"):
win = wxDialog(self, -1, text, wxPoint(100,100), wxSize(350, 200))
wxStaticText(win, -1, text, wxPoint(20, 20))
wxButton(win, wxID_OK, " OK ", wxPoint(75, 120),
wxDefaultSize).SetDefault()
wxButton(win, wxID_CANCEL, " Cancel ", wxPoint(200, 120),
wxDefaultSize)
val = win.ShowModal()
def main():
application = MyApp(0)
application.MainLoop()
if __name__ == '__main__':
main()