Is it possible to pass arguments into event bindings?

You can always use a lambda or another function to wrap up your method and pass another argument, not WX specific. b = wx.Button(self, 10, “Default Button”, (20, 20)) self.Bind(wx.EVT_BUTTON, lambda event: self.OnClick(event, ‘somevalue’), b) def OnClick(self, event, somearg): self.log.write(“Click! (%d)\n” % event.GetId()) If you’re out to reduce the amount of code to type, you … Read more

Retrieve XY data from matplotlib figure [duplicate]

This works: In [1]: import matplotlib.pyplot as plt In [2]: plt.plot([1,2,3],[4,5,6]) Out[2]: [<matplotlib.lines.Line2D at 0x30b2b10>] In [3]: ax = plt.gca() # get axis handle In [4]: line = ax.lines[0] # get the first line, there might be more In [5]: line.get_xdata() Out[5]: array([1, 2, 3]) In [6]: line.get_ydata() Out[6]: array([4, 5, 6]) In [7]: line.get_xydata() … Read more

What is the difference between Python vs Jython vs IronPython vs wxPython?

Jython and IronPython are different python implementations, both of which run on different virtual machines. Jython runs on the JVM (Java virtual machine) and IronPython runs on the CLR (common language runtime). This means that programs using these implementations can take advantage of the libraries and ecosystem of the virtual machines. For example, using Jython, … Read more

wxPython for Python 3

Updated news on this question are being posted in the wxpython wiki. Here you can find everal edits updating the initial answer (first more recent) December 2011: Great news ! First build of project Phoenix the new wxPython that will support both Python 2.x and 3.x. Current builds are however for python 2.7. November 2011: … Read more

Nice IDE with GUI designer for wxPython or Tkinter [closed]

I will talk only about WxPython because it’s the only toolkit I have experience with. TkInter is nice to write small programs (then it doesn’t require a GUI Designer), but is not really appropriate for large application development. wxFormBuilder is really good: it generates .XRC files you need to load in your program, and it … Read more

Quick and easy: trayicon with python?

For Windows & Gnome Here ya go! wxPython is the bomb. Adapted from the source of my Feed Notifier application. import wx TRAY_TOOLTIP = ‘System Tray Demo’ TRAY_ICON = ‘icon.png’ def create_menu_item(menu, label, func): item = wx.MenuItem(menu, -1, label) menu.Bind(wx.EVT_MENU, func, id=item.GetId()) menu.AppendItem(item) return item class TaskBarIcon(wx.TaskBarIcon): def __init__(self): super(TaskBarIcon, self).__init__() self.set_icon(TRAY_ICON) self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.on_left_down) def … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)