wxpython

wxPython - Trapping Mouse & Keyboard Events without window Focus

I am attempting to write a time management tool with wxPython that is ideally non-obtrusive and very much out of the way. The app so far can be used normally and minimized to the system tray for the duration of its use. However, I notice that once the frame is not in focus, as it is when its 'Iconized', the mouse and keyboard trappin...

wxPython, how do I fire events?

Hi, I am making my own button class, subclass of a panel where I draw with a DC, and I need to fire wx.EVT_BUTTON when my custom button is pressed. How do I do it? ...

Using Eval in Python to create class variables

I wrote a class that lets me pass in a list of variable types, variable names, prompts, and default values. The class creates a wxPython panel, which is displayed in a frame that lets the user set the input values before pressing the calculate button and getting the results back as a plot. I add all of the variables to the class using ...

wxpython: how to get StyledTextCtrl to render all text in monospace font?

What's the right way to use a monospaced font for all text in a StyledTextCtrl? I'm using it over the simpler TextCtrl because I need the FindText() functionality which is oddly missing from a standard text control. I'd also like to avoid hard-coding a specific font face, and instead rely on the monospace font defined by the system if p...

py2exe: Compiled Python Windows Application won't run because of DLL

I will confess I'm very new to Python and I don't really know what I'm doing yet. Recently I created a very small Windows application using Python 2.6.2 and wxPython 2.8. And it works great; I'm quite pleased with how well it works normally. By normally I mean when I invoke it directly through the Python interpreter, like this: > python...

wxPython sizer wxGridSizer's parent class method is strangely inaccessible

Hello, I am having an issue with wxPython toolkit. I am using a wx.GridSizer object to place a grid displaying some status info. I need to update this grid, and so I came up with a few different ways of doing it. The one I prefer is to simply refresh/update the text that needs the updating, so I could try detaching the wxStaticText o...

Scrolling through a `wx.ScrolledPanel` with the mouse wheel and arrow keys

In my wxPython application I've created a wx.ScrolledPanel, in which there is a big wx.StaticBitmap that needs to be scrolled. The scroll bars do appear and I can scroll with them, but I'd also like to be able to scroll with the mouse wheel and the arrow keys on the keyboard. It would be nice if the "Home", "Page Up", and those other ke...

example of embeddeding xterm in wxPython panel

I'm looking for an example or advice for embedding an xterm window in a wxPython panel. I think I can get the window ID of a panel with something like "wid=somePanel.GetHandle()" and I should be able to pass that to "xterm -use wid" but so far I'm not having much luck making that work. ...

How do I debug a py2exe 'application failed to initialize properly' error?

I'm very new to Python in general, but I made an app in Python 2.6 / wxPython 2.8 that works perfectly when I run it through Python. But I wanted to go a step further and be able to deploy it as a Windows executable, so I've been trying out py2exe. But I haven't been able to get it to work. It would always compile an exe, but when I actu...

Prevent opening a second instance

What's the easiest way to check if my program is already running with WxPython under Windows? Ideally, if the user tries to launch the program a second time, the focus should return to the first instance (even if the window is minimized). This question is similar but the answer is for VB.NET. ...

wxPython - Resizing an image with the EVT_SIZE event of its parent panel

My previous attempt at asking this question was horrible and I had also made some progress, please bear with me, I did not intend to re-ask this so many times, and it is not my style. Here is the final version: I am resizing a window that contains a DC Client painted bitmap and on the EVT_SIZE event, I am resizing it by re-scaling it (...

Need assistance with wxPython (newbie)

I need to create what I think should be a simple GUI. I have very little experience with building GUI's. I'm a visual learner and 'wxPython In Action' isn't helping me out. I don't learn well by books written by Ph.D.'s. I'm using Python 2.6. Many of the examples on the Internet don't work in Python 2.6. I need to create a GUI with ...

dynamic plotting in wxpython

Hi all, I have been developing a GUI for reading continuous data from a serial port. After reading the data, some calculations are made and the results will be plotted and refreshed (aka dynamic plotting). I use the wx backend provided in the matplotlib for this purposes. To do this, I basically use an array to store my results, in whic...

Creating child frames of main frame in wxPython.

I am trying create a new frame in wxPython that is a child of the main frame so that when the main frame is closed, the child frame will also be closed. Here is a simplified example of the problem that I am having: #! /usr/bin/env python import wx class App(wx.App): def OnInit(self): frame = MainFrame() frame.Show(...

Bind event to wx.Menu() instead of to the menu item in wxPython

My problem can be easily defined with the following code: self.Bind(wx.EVT_MENU_OPEN, self.OnAbout) This will mean that when I click on any wx.Menu() in the MenuBar, the function 'onAbout()' is called. How do I bind this event to a specific wx.Menu() which is called wx.MenuAbout() ? If you are feeling extra helpful, perhaps you could...

Why is wxGridSizer much slower to initialize on a wxDialog then on a wxFrame?

It seems that this is specific to windows, here is an example that reproduces the effect: import wx def makegrid(window): grid = wx.GridSizer(24, 10, 1, 1) window.SetSizer(grid) for i in xrange(240): cell = wx.Panel(window) cell.SetBackgroundColour(wx.Color(i, i, i)) grid.Add(cell, flag=wx.EXPAND) ...

Python wx (Python Card) logging subprocess output to window

There are similar questions to this one, but I'd like to see a clarified answer. I'm building a simple GUI with PythonCard to wrap a command line process. Specifically, it's a wrapper for a series of ANT Tasks and other custom operations so non-devs can use it. I'd like to redirect the output of the subprocess to a TextArea in the windo...

wxPython: Handling events in a widget that is inside a notebook

I have a wxPython notebook, in this case a wx.aui.AuiNotebook. (but this problem has happened with other kinds of notebooks as well.) In my notebook I have a widget, in this case a subclass of ScrolledPanel, for which I am trying to do some custom event handling (for wx.EVT_KEY_DOWN). However, the events are not being handled. I checked ...

Getting total/free RAM from within Python

From within a Python application, how can I get the total amount of RAM of the system and how much of it is currently free, in a cross-platform way? Ideally, the amount of free RAM should consider only physical memory that can actually be allocated to the Python process. ...

wxPython: Changing the color scheme of a wx.stc.StyledTextCtrl

I have a PyShell, which is supposed to be derived from wx.stc.StyledTextCtrl. How do I change the color scheme it uses? ...