Language - Python Windows Visual Studio: Difference between revisions

From Phidgets Support
No edit summary
(Redirected page to Language - Python)
 
Line 1: Line 1:
[[Category:Language]]{{NoTitle}}
#REDIRECT [[Language - Python]]
{|
|style="vertical-align:middle; width: 60%;"|
<font size=6>'''Language - Python'''
 
'''Windows with Visual Studio'''</font>
 
Welcome to using Phidgets with Python! By using Python, you will have access to the complete Phidget22 API, including events.
 
Visual Studio is an IDE provided by Microsoft that can be used to develop code in a wide variety of programming languages, including Python.
 
|{{TOC limit|2}}
|}
 
{{Language_-_Python_Intro_Windows|
{{Language_-_Python_Intro_Windows|
<tabber>
PIP=
The recommended way to install the '''Phidget22 Python module''' is using the '''PIP package manager'''.
<br><br>
You can install the Phidget22 libraries for your current Visual Studio project with PIP by opening '''View > Other Windows > Python Environments'''
[[File:VisualStudio_PythonEnvironments.png|link=|center|800px]]
<br><br>
Next, select '''Packages (PyPI)''' from the drop-down menu:
[[File:VisualStudio_PythonPackages.png|link=|center|800px]]
<br><br>
Type '''Phidget22''' into the search bar, then click '''Install Phidget22''':
[[File:VisualStudio_Install_Phidget22.png|link=|center|800px]]
 
Success! Your project now has access to Phidget22.
|-|
Manual Install=
To install the Phidget22 Python module without PIP, you will need to download the [{{SERVER}}/downloads/phidget22/libraries/any/Phidget22Python.zip Phidget22 Python module].
 
After unpacking the Phidget22 Python module, open the '''Command Prompt''' (press the Windows key and search for "cmd") Locate the folder where you downloaded the Python module and enter the following command:
<syntaxhighlight lang=python>
python setup.py install
</syntaxhighlight>
 
This will build the module and install the Python module files into your site-packages directory.
 
[[File:Python_install.png|link=|center]]
</tabber>
}}}}
{{Finding Code Samples|Python}}
 
==Setting Up a New Project==
When you are building a project from scratch, or adding Phidget functionality to an existing project, you'll need to configure your development environment to properly link the Phidget Python library.
 
To start, create a new Python project:
[[Image:Python_vs_newproject.PNG|link=|center|850px]]
 
 
Then open the Python file that was generated with the project.
 
[[Image:Python_vs_blank_project.png|link=|center|850px]]
 
==Using the Code Samples==
Now that you have configured a project to use Phidgets, you can copy the code sample from the [{{server}}/?view=code_samples&lang=Python Code Samples] page into your project, and run it.
 
{{Language_Page_What's_Next}}

Latest revision as of 16:44, 15 March 2021

Redirect to: