[Tutor] Need Help Modifying a wxPython GUI (scrolling display and logging)

Matt D md123 at nycap.rr.com
Fri Jun 7 21:44:49 CEST 2013


> It looks to me like there is a separate thread that pulls data off some queue 
> and then hands it to WX in the form of a DataEvent. WX calls display_data 
> which unpickles the data. Pickle is just a format of storage and can store 
> all Python built-in types. It seems that what is stored is a Python 
> dictionary. In fact, you can probably add (and should add) a print statement 
> to print attrs in display_data to see the data. It's always important to know 
> what your data looks like. If you are only familiar with Visual Basic and C++, 
> you may want to familiarize yourself with Dictionaries (aka Hashmaps). They 
> are basically containers with key-value pairs for unique keys. By knowing the 
> name of the data you want (for example "duid") you can retrieve the value and 
> post it back to the appropriate TextCtrl.
> 

Hey,
So is the separate thread is this??:

import gnuradio.gr.gr_threading as _threading	

This is how the pickled data is brought into the wxPython UI? I have
been unable to find any explanation on the web about the wxDATA_EVENT?

The 'class traffic_watcher_thread(_threading.Thread):' is this what
waits on the message queue for another frame of pickled data to come in?

One of the main problems I have with understanding the Python code I
have shared is that the pickle comes from C++ code.  The program uses
C++ for what is computational intense and it uses Python for the UI and
for sending the data stream between the C++ blocks.  I have never tried
modifying code in a program that uses two languages before.

>From python.org/2/library/pickle:
"Perhaps the most obvious thing to do with these byte streams is to
write them onto a file" and  sense "the pickle data format uses a
printable ASCII representation" . . . "it is possible for a human to
read the pickled file with a standard text editor."  I would love to
have this wxPython code write the pickled data to file just to see
exactly what is in it.  Do you know of some sort of code I can put in to
make the pickle write to a file?  I think this is the best starting
point instead of playing with the UI.

Thank you very much for your attention.
Cheers,
Matt




More information about the Tutor mailing list