4891 views|7 replies

95

Posts

1

Resources
The OP

Learn to write programs using wxpython [Copy link]

After understanding the implementation principle, use the powerful Python to directly write the GNU Radio application, and also get familiar with the use of the wxPython toolkit. The main implementation is conventional AM (it is a step easier to implement DSB with carrier suppression). The final waveform is:

The carrier is a 20khz sine wave with an amplitude of 10, and the modulating signal is a 1khz sine wave with an amplitude of 0.5. The modulation factor is 0.5. The envelope can also be clearly seen from the figure. The figure below shows the spectrum. The 20khz carrier component is the largest, and there are two other components with a distance of 1khz. This is the regular spectrum diagram of an AM signal.

The following steps are also summarized in the process of writing the program:

1. The first step is still to import the corresponding packages. Here, more packages need to be imported than before, including wx, stdgui2, fftsink2 and scopesink2. These are all necessary packages for using the wxpython GUI tool.

2. The parent classes of the previously defined classes are all gr.top_block. Here, a new class is created, which inherits from stdgui2.std_top_block. If we trace it back, this class also inherits from gr.top_block.

3. The program uses scopesink2 and fftsink2. They are added as parts of the frame. The layout levels in wxpython are: windows, frame, panel, vbox, button, etc. Most of them involve a parent parameter to set the level at which the control is placed.

4. The last few lines are almost the same. Define a stdgui2.stdapp object using the previously instantiated class, and then start the object's main process mainloop. This way the program can run and display the results.

Checking the stdgui2.py file gives the entire file structure. This file defines four classes: stdapp, stdframe, stdpanel, and the previous std_top_block . My understanding of the entire process is this: when using the class test_graph (defined by myself) inherited from stdgui2.std_top_block to generate an instance app of the stdapp class, the first thing to do here is to initialize test_graph. When instantiating stdapp, the newly generated test_graph is used as a parameter to generate app. In the OnInit method of app, another instance frame=stdframe() is defined. In this way, frame is generated, and its various methods can also be used. In the __init__ of frame, a panel is defined. So the program uses frame as a parameter to generate panel according to the definition of stdpanel. At this point, all the elements involved have been instantiated. The entire stdgui2 is a process of overall calling. It's quite messy here, but you can understand the process by looking at its original definition file.





This post is from RF/Wirelessly

Latest reply

This is developed by linxu  Details Published on 2012-11-28 16:50

2140

Posts

3

Resources
2
Nice interface is from linxu
This post is from RF/Wirelessly

Comments

Yes, Ubuntu is more convenient to use.  Details Published on 2012-11-23 16:00

95

Posts

1

Resources
3
Yes, Ubuntu is more convenient to use.
This post is from RF/Wirelessly

Comments

I need help with a method to install 12.04 directly to PC. I saw on the Internet that it can be made into a USB installation disk and some third-party software can be used to insert the USB disk to extract the image. It also said that you can enter the live without installing. I really don't understand this. I can only enter the installation or the 11.xx iso. The official 12.04 iso (in  Details Published on 2012-11-24 17:37
Personal signatureIf winter comes,can spring be far behind?

2140

Posts

3

Resources
4
Hmm, I need help with a method to install 12.04 directly to PC. I saw online that it can be made into a USB installation disk and some third-party software can be used to insert the USB disk to extract the image. It also said that you can enter the live without installing. I really don't understand this. The only way to enter the installation is still an 11.xx iso, the official 12.04 iso (it also contains wubi, I don't like this installation, is this iso also used to install the real system) I tried to install it but it didn't work. . I don't want to use a virtual machine. It seems that you are not using a virtual machine. Thanks in advance, Qt in the virtual machine is so slow, I can't stand it
This post is from RF/Wirelessly

Comments

Well, I directly divided a 200G partition on the hard disk, formatted the file system format to ext2, and then installed it. Because I also have win7, so when I start up, the grub that comes with Ubuntu can let me choose which system to start. At that time, I used a burned CD DVD (normal C  Details Published on 2012-11-24 17:52

95

Posts

1

Resources
5
Well, I directly divided a 200G partition on the hard disk, formatted the file system format to ext2, and then installed it. Because I also have win7, the grub that comes with Ubuntu can let me choose which system to boot when I start it. At that time, I used a burned CD DVD for installation (ordinary CDs seem to be unable to fit). If you want to use a USB flash drive, I have not tried this. I used to install the hard disk directly from the CD, but I also found some information at that time, which introduced burning to a USB flash drive and using the USB flash drive as a boot disk for installation. If you are interested, I can send it to you.
This post is from RF/Wirelessly

Comments

Haha, thanks, I'll try it.  Details Published on 2012-11-24 18:01
Personal signatureIf winter comes,can spring be far behind?

2140

Posts

3

Resources
6
Haha, thanks, I'll try it.
This post is from RF/Wirelessly

251

Posts

0

Resources
7
This is developed by linxu
This post is from RF/Wirelessly

Comments

Yes  Details Published on 2012-11-28 17:31
Personal signature传感器专家网  http://www.sensorexpert.com.cn/

95

Posts

1

Resources
8
Yes
This post is from RF/Wirelessly
Personal signatureIf winter comes,can spring be far behind?

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>
    快速回复 返回顶部 Return list