Editing TutorialPythonFunctions

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 98: Line 98:
 
6. Use the new function from GRC. We might have to import the module if this is all that we are using from it; it might already be pulled in if you are using a block from this module in the flowgraph already. We'll use it as a stand-alone function, though, to be clear how to import it. In the image below, we put an "Import" block that calls '''import testpy''', which loads that into the Python module space. We then use the '''squareme''' function from '''testpy''' to square a value. The Properties box is open so we can see both the calling convention and the results (12*12 = 144).
 
6. Use the new function from GRC. We might have to import the module if this is all that we are using from it; it might already be pulled in if you are using a block from this module in the flowgraph already. We'll use it as a stand-alone function, though, to be clear how to import it. In the image below, we put an "Import" block that calls '''import testpy''', which loads that into the Python module space. We then use the '''squareme''' function from '''testpy''' to square a value. The Properties box is open so we can see both the calling convention and the results (12*12 = 144).
  
[[File:Gr_python_tutorial_squareme.png|Gr_python_tutorial_squareme.png]]
+
[[File:gr_python_tutorial_squareme.png|gr_python_tutorial_squareme.png]]
  
 
7. Now you can do something that's actually interesting with Python. This tutorial just shows the how, not the what. There are plenty of more advanced things we can do because of the nature and power of Python. But that's up to you.
 
7. Now you can do something that's actually interesting with Python. This tutorial just shows the how, not the what. There are plenty of more advanced things we can do because of the nature and power of Python. But that's up to you.

Please note that all contributions to GNU Radio are considered to be released under the Creative Commons Attribution-ShareAlike (see GNU Radio:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)