wxpython

wxPython: Dragging a file into window to get file path

喜欢而已 提交于 2019-12-14 01:10:38
问题 I want to drag a file into a window and get the file path. I've tried doing this: class CSVDropper(wx.FileDropTarget): def __init__(self, data): wx.FileDropTarget.__init__(self) self.data = data def OnDropFiles(self, x, y, filenames): self.data = filenames print self.data then in the main window: # Drag & Drop self.csv_path = None self.drop_table = CSVDropper(self.csv_path) self.SetDropTarget(self.drop_table) But this does nothing. I've tried running this tutorial code, but it doesn't do

Python multiprocessing, PyAudio, and wxPython

若如初见. 提交于 2019-12-14 00:41:28
问题 I have a wxPython GUI, and would like to use multiprocessing to create a separate process which uses PyAudio. That is, I want to use PyAudio, wxPython, and the multiprocessing module, but although I can use any two of these, I can't use all three together. Specifically, if from one file I import wx, and create a multiprocessing.Process which opens PyAudio, PyAudio won't open. Here's an example: file: A.py import wx import time use_multiprocessing = True if use_multiprocessing: from

wxPython Mac OS X Fullscreen work around error

冷暖自知 提交于 2019-12-13 22:12:45
问题 I was trying to get fullscreen support for a wxPython app using the code in the answer from this stackoverflow question wxPython MacOS X Lion full screen mode My Error Traceback (most recent call last): File "test_mac_fullscreen.py", line 36, in <module> frame = Frame() File "test_mac_fullscreen.py", line 29, in __init__ SetFullScreenCapable(self) File "test_mac_fullscreen.py", line 16, in SetFullScreenCapable window = frameobj.window() AttributeError: 'NSHIObject' object has no attribute

Error when updating wxmplot graph

偶尔善良 提交于 2019-12-13 20:12:22
问题 I am trying to create a graph that updates dynamically using wxmplot in Python 3.6. According to the documentation here: http://cars.uchicago.edu/software/python/wxmplot/plotpanel.html#plotpanel.plot, I should be calling the update_line function which allows for faster graph updates compared to redrawing the plot. However, this function is not working for me. Here is my code: import wx import random from wxmplot import PlotPanel class MainFrame(wx.Frame): def __init__(self, parent): wx.Frame.

cv2.VideoCapture doesn't return frames

*爱你&永不变心* 提交于 2019-12-13 20:00:07
问题 I am trying to save a webcam video with wx Buttons. This is my code def OnRecord(self, evt): capture = cv2.VideoCapture(0) if (not capture.isOpened()): print "Error" # video recorder fourcc = cv2.cv.CV_FOURCC('D', 'I', 'V', 'X') # cv2.VideoWriter_fourcc() does not exist out = cv2.VideoWriter("output.avi", fourcc, 9.0, (640, 480), True) # record video while (capture.isOpened()): ret, frame = capture.read() if not ret: print "Capture Failed" else: out.write(frame) cv2.imshow('Video', frame) But

Dynamic Chart in Python

ε祈祈猫儿з 提交于 2019-12-13 18:28:29
问题 I am essentially trying to replicate the google finance chart, but for sensor data. I would like to embed the chart in a GUI and have it update on a timer (which samples the sensor for it's value). I would like to incorporate panning, resizing, and adding moving averages, much like the google finance charts, all of which is updated at some steady interval. Much of my code base is already in python, so I would like to stick with it. Can this be done with Python? I have checked out matplotlib,

wxpython: How do we remove null byte from string when using textcontrol.GetValue()

我与影子孤独终老i 提交于 2019-12-13 18:20:49
问题 Objective: Use two textcontrol boxes, one as an input and one as an output However there is an additional step in the process, which fails likely because textcontrol.GetValue() returns null byte in addition So say I have self.tc1 = wx.TextCtrl(panel) self.tc2 = wx.TextCtrl(panel) and I go about it cmd = self.tc1.GetValue() How do I exclude last character of string cmd (or any null byte) Output: TypeError: execv() argument 1 must be encoded string without NULL bytes, not str 回答1: Just figured

Freeze few column in wxgrid

随声附和 提交于 2019-12-13 17:36:37
问题 I have a window that is split to have a custom tree ctrl on left panel and a grid table on the right. Now I want the grid table to display the information in such a way that first few columns freeze (not scroll) while the remaining data has an option to scroll horizontally. I have no clue how to proceed, please help. I have seen that splitter window can be of some help, can someone provide a sample code. 回答1: There is no built-in way to do that. You would need to use grids and keep them kind

On button click open wxpython TextEntryDialog and get multiple input from user

时光毁灭记忆、已成空白 提交于 2019-12-13 16:32:29
问题 I want to open a TextEntryDialog, when user clicks the button. So if i have a button in the parent frame which i am going to bind this way: self.Bind(wx.EVT_BUTTON, self.OnAddNew, self.add_new_btn) Now i have to open a TextEntryDialog when user clicks the button add_new. I want to make textentrydialog somewthing like this Python, Using wxPython to get multiple input from user How can i do that? Do i need to just paste that code in ` def OnAddNew(self, event): Here is the pastebin link to my

Use class variable in another class

假如想象 提交于 2019-12-13 15:31:50
问题 Greetings everyone, I'm currently working on an app using Python and wxPython. In it I have a Dialog where several fields are filled in order to insert a "document" in a database. The layout of that Dialog consists basically of a wx.Notebook, with several "tabs", each containing some sort of fields. # Dialog class class NovoRegisto(wx.Dialog): def __init__(self,parent): wx.Dialog.__init__(self, parent, title='Registar Nova O.T.', size=(900,600)) painel = wx.ScrolledWindow(self, -1, style=wx