Template:PT3 PYTHON WIN VS: Difference between revisions

From Phidgets Support
(Created page with "<div class="phd-slide-deck" data-deck="PT3_PYTHON_WIN_VS"> <div class="phd-slide-deck-header"><h3>Language - Python</h3></div> <div class="phd-slides"> <div class="phd-slide">...")
 
No edit summary
 
Line 17: Line 17:


<div class="phd-slide">
<div class="phd-slide">
<h2>Requirements</h2>
<h2>Installing the Phidget Python Module</h2>


<p>First, make sure you have the following installed:</p>
<p>First, install <span>[https://www.python.org/downloads/ Python3]</span> if you haven't already.</p>


<p>● Phidgets Drivers for Windows (see Part 1 of this user guide)</p>
<p>
You can install the Phidget22 libraries and python module for your current Visual Studio project with PIP by opening
<b>View > Other Windows > Python Environments</b>
</p>


<p>● <span>[https://www.python.org/downloads/ Python]</span> (2.7 and 3.6+ are both compatible with Phidgets)</p>
<div class="phd-lazy-image" data-src="https://www.phidgets.com/decks/PT3_PYTHON_WIN_VS/-x325/50/VisualStudio_PythonEnvironments.png"></div>
</div>
</div>


Line 29: Line 32:
<h2>Installing the Phidget Python Module</h2>
<h2>Installing the Phidget Python Module</h2>


<p>Select your preferred installation method below:</p>
<p>Next, select <b>Packages (PyPI)</b> from the drop-down menu:</p>


<div class="phd-panels">
<div class="phd-lazy-image" data-src="https://www.phidgets.com/decks/PT3_PYTHON_WIN_VS/-x350/50/VisualStudio_PythonPackages.png"></div>
<div class="phd-panel phd-flex-column-align-center phd-flex-column-justify-middle">
<div class="phd-to-deck-button phd-text-link" data-to-deck="PT3_PYTHON_WIN_VS_1">
<div class="phd-lazy-image" data-src="https://www.phidgets.com/decks/PT3_PYTHON_WIN_VS/-x200/50/pip.jpg"></div>
<h2>PIP Install</h2>
</div>
</div>
<div class="phd-slide">
<h2>Installing the Phidget Python Module</h2>
<p>Type <b>Phidget22</b> into the search bar, then click <b>Install Phidget22</b>:</p>
<div class="phd-lazy-image" data-src="https://www.phidgets.com/decks/PT3_PYTHON_WIN_VS/-x320/50/VisualStudio_Install_Phidget22.png"></div>
<p>Success! Your project now has access to Phidget22.</p>
</div>
</div>
<div class="phd-panel phd-flex-column-align-center phd-flex-column-justify-middle">
 
<div class="phd-to-deck-button phd-text-link" data-to-deck="PT3_PYTHON_WIN_VS_2">
<div class="phd-slide">
<div class="phd-lazy-image" data-src="https://www.phidgets.com/decks/PT3_PYTHON_WIN_VS/-x200/50/cmd.jpg"></div>
<h2>Setting Up a New Project</h2>
<h2>Manual Install</h2>
 
<p>
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.
</p>
 
<p>To start, create a new Python project:</p>
 
<div class="phd-lazy-image" data-src="https://www.phidgets.com/decks/PT3_PYTHON_WIN_VS/-x295/50/Python_vs_newproject.png"></div>
</div>
</div>
<div class="phd-slide">
<h2>Setting Up a New Project</h2>
<p>Then open the Python file that was generated with the project.</p>
<div class="phd-lazy-image" data-src="https://www.phidgets.com/decks/PT3_PYTHON_WIN_VS/-x350/50/Python_vs_blank_project.png"></div>
</div>
<div class="phd-slide">
<h2>Finding Code Samples</h2>
<p>
To find the code sample to use for your Phidget, navigate to the <span>[https://www.phidgets.com/?view=code_samples&lang=Python Code Samples]</span> page and
select your device from the drop-down menu.
</p>
<div class="phd-lazy-image" data-src="https://www.phidgets.com/decks/PT3_PYTHON_WIN_VS/-x250/50/Python_sample_code.png"></div>
<p>Once you select your device, the code sample generator will give you a working code sample, and a selection of options to customize it to your needs.</p>
</div>
</div>
<div class="phd-slide">
<h2>Using the Code Samples</h2>
<p>If it's unclear what any of the options do, click on the nearby <b>'?'</b> for more info.</p>
<p>Once you've made your selections, click the copy button and paste the code into your new project.</p>
<div class="phd-lazy-image" data-src="https://www.phidgets.com/decks/PT3_PYTHON_WIN_VS/-x320/50/Python_Sample_Code_Copy.png"></div>
</div>
</div>


<p>The recommended way to install the Phidget22 Python module is using the <b>PIP package manager</b>.</p>
<div class="phd-slide">
<h2>What's Next?</h2>
 
<p>{{Slide_Deck_PT3_Outro}}</p>
</div>
</div>
</div>
</div>

Latest revision as of 22:16, 17 December 2024

Windows with Visual Studio

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.

Installing the Phidget Python Module

First, install Python3 if you haven't already.

You can install the Phidget22 libraries and python module for your current Visual Studio project with PIP by opening View > Other Windows > Python Environments

Installing the Phidget Python Module

Next, select Packages (PyPI) from the drop-down menu:

Installing the Phidget Python Module

Type Phidget22 into the search bar, then click Install Phidget22:

Success! Your project now has access to Phidget22.

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:

Setting Up a New Project

Then open the Python file that was generated with the project.

Finding Code Samples

To find the code sample to use for your Phidget, navigate to the Code Samples page and select your device from the drop-down menu.

Once you select your device, the code sample generator will give you a working code sample, and a selection of options to customize it to your needs.

Using the Code Samples

If it's unclear what any of the options do, click on the nearby '?' for more info.

Once you've made your selections, click the copy button and paste the code into your new project.

What's Next?

Now that you've set up Phidgets in your programming environment, you should read our guide on Phidget Programming Basics to learn the fundamentals of programming with Phidgets.

«
»