wxpython

wxpython can't capture EVT_KEY_DOWN enent

試著忘記壹切 提交于 2020-01-02 17:31:06
问题 I can't capture EVT_KEY_DOWN event. But can capture EVT_KEY_UP. Python version : 2.7.3 wxPython version : 2.8.12.1 (gtk2-unicode) system info: Mint 14 Nadia , Linux 3.5.0-17-generic(x86_64) Following is my code #!/usr/bin/env python import sys, os import wx class WinFrame(wx.Frame): def __init__(self, parent, title): super(WinFrame, self).__init__(parent, title=title, size=(400,400)) self.panel = wx.Panel(self,-1, size=(400,400)) self.panel.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) self.panel

wx.TaskBarIcon in Ubuntu 13.04 (GNOME or Unity)

 ̄綄美尐妖づ 提交于 2020-01-02 08:43:44
问题 I've used wx.TaskBarIcon to successfully implement a systray interface to my application on Windows and Mac but am having severe trouble with it on Ubuntu. There's already been two SO questions regarding this on previous versions of Ubuntu: wxTaskBarIcon in Ubuntu 12.10 wx.TaskBarIcon on Ubuntu 11.04 Neither provide real answers or workarounds. As I understand it, the systray whitelist was implemented and was subsequently obsoleted, which apparently leaves wxWidgets and wxPython applications

wxPython: How to clear default text in TextCtrl with one click

China☆狼群 提交于 2020-01-02 05:28:07
问题 I am making a GUI using wxPython, and I have a text box that requires user input: self.boxQuantity = wx.TextCtrl(panel, value="Enter quantity", pos=(100, 150), size=(100, 30)) self.Bind(wx.EVT_TEXT, self.getQuantity, self.boxQuantity) I want the user to be able to click on the text box, and "Enter quantity" to disappear immediately, instead of having to use backspace. Is this possible? I'm using Windows 10, Python 2.7.9. 回答1: I think you want def toggle1(evt): if self.boxQuantity.GetValue() =

How can I store objects other than strings in a wxPython ComboBox?

╄→尐↘猪︶ㄣ 提交于 2020-01-01 19:11:12
问题 I have a list of Vertex objects, each with their own labels and id's. How can I use this list as a model for a wxPython ComboBox such that when a user selects an option, I can immediately retrieve the Vertex id? It appears that ComboBox only accepts strings as a model. I cannot create a dictionary of label to id pairs since there are duplicate labels. I noticed a ComboCtrl class which I can subclass to create a specialized combo box, but I feel like there is a easier solution to this. 回答1:

How to get item list from wxpython ListBox

安稳与你 提交于 2020-01-01 14:35:19
问题 Is there a single method that returns the list of items contained in a wxPython listBox? I cant seem to find anything anywhere in the documentation or anywhere for that matter. All that I can think to do is to set the selection to all of the items and then get the selected items, though seems like an ugly roundabout way of doing something that should be simple. Update: As pointed out by jeremy the way to do this is with GetStrings() e.g. listBoxList = yourListBox.GetStrings() 回答1: wx.ListBox

wxpython: automatically resize a static image (staticbitmap) to fit into size

佐手、 提交于 2020-01-01 03:21:18
问题 My wxPython project has a frame, with multiple nested sizers. One of the sizers contains a wxStaticImage with a bitmap that is read from a file. I need the image to resize (grow/shrink) every time the frame is resized, so it will fit it's sizer's boundaries. (I think that) I know how to resize an image. What I don't know is how to: how to get the image's container's width or height? maybe i overlooked a property that does it auotmatically? (for now, I don't mind the proportions) Edit:

wx.Python: Passing control between multiple panels

早过忘川 提交于 2019-12-31 05:25:30
问题 I'm a newbie to wxPython, and have researched similar questions, but can't specifically find an answer to my question. I'm creating two panels with a splitter. Each panel has a number of widgets. I'd like to have a widget in one panel control some properties of the other and vice versa) In the example, I'm trying to change the background of RightPanel from a button in LeftPanel . I'm obviously doing something wrong as a I get an error: TypeError: init () takes exactly 2 arguments (1 given)

Redirect command prompt output to a python generated window

只谈情不闲聊 提交于 2019-12-31 04:27:06
问题 Developed a script which builds a project using msbuild. I have GUI developed using wxpython which has a button on which when user clicks would build a project using msbuild. Now, i want to open a status window when user click on that button and shows all the output which shows in the command prompt and command prompt should not be displayed i.e,redirecting the command prompt output to the user GUI status window. My build script is, def build(self,projpath) arg1 = '/t:Rebuild' arg2 = '/p

How to remove initial wx.RadioBox selection?

て烟熏妆下的殇ゞ 提交于 2019-12-31 02:57:34
问题 I have the following code : myList =['a','b'] rb=wx.RadioBox(self.panel, -1, "Options :", (0, 0), wx.DefaultSize,myList, 2, wx.RA_SPECIFY_COLS) When it renders first time I see that a choice has been made how can I change the code that when this radibox rendered first time there are no option has been chosen. 回答1: The use of a radio box implies, "there is a list of two or more options that are mutually exclusive and the user must select exactly one choice." The radio box never exists in a

Pygame with Multiple Windows

白昼怎懂夜的黑 提交于 2019-12-31 02:26:28
问题 I need to to build an application that has multiple windows. In one of these windows, I need to be able to play a simple game and another window has to display questions and get response from a user that influences the game. (1) I was wanting to use pygame in order to make the game. Is there a simple way to have pygame operate with multiple windows? (2) If there is no easy way to solve (1), is there a simple way to use some other python GUI structure that would allow for me to run pygame and