wxpython

Set global hotkey with Python 2.6

霸气de小男生 提交于 2019-12-29 04:43:06
问题 I wanna setup a global hotkey in python 2.6 that listens to the keyboard shortcut ctrl + D or ctrl + alt + D on windows, please help me 回答1: Tim Golden's python/win32 site is a useful resource for win32 related programming in python. In particular, this example should help: Catch system-wide hotkeys 回答2: I suggest pyhk. It allows for global wide hotkey registration in python and comes with examples and documentation. Pyhk builds on pyhook. Hotkey registration is as simple as: pyhk.addHotkey

When is “self” required?

三世轮回 提交于 2019-12-28 06:45:12
问题 I have been using classes for only a short while and when I write a method, I make all variables reference self, e.g. self.foo. However, I'm looking through the wxPython in Action book and notice that "self" isn't used all the time. For example: import wx class TextFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, -1, 'Text Entry Example', size=(300, 100)) panel = wx.Panel(self, -1) basicLabel = wx.StaticText(panel, -1, "Basic Control:") basicText = wx.TextCtrl(panel, -1, "I

OK Button crashes in wxPython

做~自己de王妃 提交于 2019-12-25 18:23:18
问题 I'm working on XP and using WX python As GUI library. Recently I look a lot of problems, for example If I Use a @MikeDriscoll 's example the code at the second print the python interpreter crashes, and I don't know why and how track this error (more important)... import wx ######################################################################## class SampleDialog(wx.Dialog): """""" #---------------------------------------------------------------------- def __init__(self, parent): ""

Changing font colour of StyledTextCtrl

旧城冷巷雨未停 提交于 2019-12-25 17:39:35
问题 I am trying to change the default font colour of the following StyledTextCtrl, I've been testing this for awhile and changing the hex code values however I can't seem to get it to change colour. (I want it to be purple). The current default colour is Black. When I add self.StyleSetForeground(wx.stc.STC_STYLE_DEFAULT,wx.Colour(230, 230, 250)) It changes the colour of the line number. (On the side of the StyledTextCtrl, it shows the line you are on). Does anyone know a solution, or maybe whats

Not Implemented error in wxPython

浪尽此生 提交于 2019-12-25 17:19:04
问题 I'm getting this error whenever I run my wxpython code. Traceback (most recent call last): File "musicplayer.py", line 203, in MyPanel(frame, -1) File "musicplayer.py", line 17, in __init__ self.mc = wx.media.MediaCtrl(self, style=wx.SIMPLE_BORDER) File "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/media.py", line 96, in __init__ _media.MediaCtrl_swiginit(self,_media.new_MediaCtrl(*args, **kwargs)) NotImplementedError My program is to create a music player in wxpython. Any help

Not Implemented error in wxPython

百般思念 提交于 2019-12-25 17:18:11
问题 I'm getting this error whenever I run my wxpython code. Traceback (most recent call last): File "musicplayer.py", line 203, in MyPanel(frame, -1) File "musicplayer.py", line 17, in __init__ self.mc = wx.media.MediaCtrl(self, style=wx.SIMPLE_BORDER) File "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/media.py", line 96, in __init__ _media.MediaCtrl_swiginit(self,_media.new_MediaCtrl(*args, **kwargs)) NotImplementedError My program is to create a music player in wxpython. Any help

onclick function matplotlib

流过昼夜 提交于 2019-12-25 14:45:31
问题 cmap = mpl.colors.ListedColormap([[1,0,0], [0,0,1], [0,1,0], [1,1,0]]) self.fig = plt.figure(figsize=(6,6)) self.ax = self.fig.add_axes([0.1, 0.1, 0.8, 0.8]) x_ax = self.fig.add_axes([0.05, 0.1, 0.05, 0.8]) x2_ax = self.fig.add_axes([0.05, 0.1, 0.05, 0.8]) y_ax = self.fig.add_axes([0.1, 0.05, 0.8, 0.05]) x_ax.imshow(xcolors, cmap=cmap, interpolation='none') x_ax.set_aspect('auto') x_ax.set_position((0.1,0.1,0.05,0.8)) y_ax.imshow(ycolors, cmap=cmap, interpolation='none') x_ax.set_picker(5)

python GUI to EXE with image and modules

六月ゝ 毕业季﹏ 提交于 2019-12-25 12:10:00
问题 I have created a Python GUI and trying to convert it to .exe with py2exe. i am using following modules wx,matplotlib,numpy,time,serial,random and a .ico image as logo. i tried create a setup.py file but it didn't work.need help creating setup file to generate .exe of my GUI. 回答1: It would be convenient if you could provide some details regarding why the .EXE is not being created. If you can't provide the details then please go through these questions on Stackoverflow, they maybe helpful: How

python GUI to EXE with image and modules

南笙酒味 提交于 2019-12-25 12:09:56
问题 I have created a Python GUI and trying to convert it to .exe with py2exe. i am using following modules wx,matplotlib,numpy,time,serial,random and a .ico image as logo. i tried create a setup.py file but it didn't work.need help creating setup file to generate .exe of my GUI. 回答1: It would be convenient if you could provide some details regarding why the .EXE is not being created. If you can't provide the details then please go through these questions on Stackoverflow, they maybe helpful: How

how do i start a wxPython program with a dialogbox, then pop another dialog and then make a basic canvas [duplicate]

荒凉一梦 提交于 2019-12-25 11:04:27
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How to link multiple wx.Dialogs in wxPython Hi I want to make a wxPython app which first shows me a messageDialog, then an input dialog (which saves the playerName) and then makes a dc (DrawCanvas). Can any1 set up this framework for me plz? (I keep mixing up panels with frames and dialogs) 回答1: I already answered this, but here's my answer again: just put the dialog creation and instantiation right after the