Pythonprogramme
Python programs
Im Manuskript Consolation for Linux dilettantes (Linux ohne X mit dem Raspberry Pi) von Alfred H. Gitter gibt es Beispiele von Python-Programmen zur Verdeutlichung von Anwendungen und der Funktion zusätzlicher Python-Module. Einige werden hier als herunter ladbare Textdateien mit der Endung .txt angeboten. Ich empfehle, die Endung nach dem Herunterladen in .py zu ändern. Die Reihenfolge ist alphabetisch geordnet, entsprechend dem Namen der Datei. Sie können frei verwendet werden, aber über eine Quellenangabe des Manuskripts würde ich mich freuen. Erklärungen findet man im Manuskript.
In the manuscript Consolation for Linux dilettantes by Alfred H. Gitter there are examples of Python programs to illustrate applications and the function of additional Python modules. Some are offered here as downloadable text files with the ending .txt. I recommend changing the extension to .py after downloading. The order is arranged alphabetically, according to the name of the file. They can be used freely, but I would be happy to receive a citation to the source of the manuscript. Explanations can be found in the manuscript.
calendar_month_and_christmas.txt zeigt den aktuellen Monat und Wochentag von Heiligabend
shows the current month and day of the week from Christmas Eve
calendar_month_of_impact.txt zeigt Kalender für April 2029 (in dem der Asteroid Apophis kommt)
shows calendar for April 2029 (in which the asteroid Apophis is coming)
controls_if.txt Beispiel für eine bedingte Anweisung mit dem Schlüsselwort if
example of a conditional statement with the if keyword
controls_if-else.txt Beispiel für eine bedingte Anweisung mit if und else
example of a conditional statement with if and else
controls_if-elif-else.txt Beispiel für eine bedingte Anweisung mit if und elif und else
example of a conditional statement with if and elif and else
controls_case.txt Beispiel für eine Auswahl aus mehreren Fällen (ähnlich switch/case in C)
example of selecting from multiple cases (similar to switch/case in C)
dax_tagesschau.txt lädt und zeigt Aktienkurse aus der Webseite der Tagesschau
loads and displays share prices from the Tagesschau website
geopy_get-coordinates.txt ermittelt die geographischen Koordinaten zu einer gegebenen Adresse
determines the geographical coordinates of a given address
here.txt ermittelt die öffentliche IP-Adresse und den ungefähren Standort des Rechners
determines the public IP address and the approximate location of the computer
mcptest.txt testet den A/D-Wandler MCP3208 (Ausgabe der Spannung an Kanal CH2)
tests the A/D converter MCP3208 (output of the voltage on channel CH2)
ob_internet.txt prüft, ob Internetverbindung besteht und meldet das Ergebnis
checks whether there is an internet connection and reports the result
osm_more.txt lädt und zeigt eine Landkarte von Webseite der OpenStreetMap Foundation
loads and displays a map from the OpenStreetMap Foundation website
pa_test.txt prüft die Funktionsfähigkeit von PyAudio
checks the operativeness of PyAudio
pa_dev.txt gibt eine Liste der angeschlossenen Audiogeräte mit ihren PyAudio device indices aus
displays a list of the available audio devices together with their PyAudio device indices
pa_wave.txt spielt eine Audiodatei im WAV-Format mithilfe der Pythonmodule pyaudio und wave
plays a WAV audio file with a Python program using the modules pyaudio and wave
pa_record.txt speichert Tonaufnahme über ein Mikrophon (an USB-Soundkarte) in Audio-Datei
saves sound recording via a microphone (on a USB sound card) in an audio file
pimail2.txt sendet eine E-Mail mit Attachment über vorhandenes Konto bei GMX-Deutschland
sends an email with attachment via existing account at GMX-Germany
plot_linregress.txt mit einem Matplotlib - Beispiel für einen Plot mit linearer Regression
with a Matplotlib example of a linear regression plot
plot_saeulen.txt mit einem Matplotlib - Beispiel für ein Säulendiagramm (vertical bar chart)
with a Matplotlib - example for a vertical bar chart
plot_shockley.txt mit Matplotlib - Beispiel für den Plot einer nichtlineare Ausgleichsrechnung (fit)
with Matplotlib - example for the plot of a nonlinear compensation calculation (fit)
pyaudio_record.txt speichert eine Tonaufnahme mit USB-Mikrophon als WAV-Audiodatei
saves a sound recording with a USB microphone as a WAV audio file
pygame_gpio.txt zeigt, wie PyGame auf die Eingabe von Tastern über GPIO reagiert
shows how PyGame reacts to button input via GPIO
pygame_image.txt zeigt, wie PyGame eine Bilddatei auf dem Bildschirm darstellt
shows how PyGame displays an image file on the screen
pygame_menu.txt zeigt ein Menü, aus dem man eine MP3-Audiodatei zum Abspiel wählt
shows a menu from which you can select an MP3 audio file to play
pygame_movie.txt zeigt, wie PyGame mithilfe von moviepy einen Film darstellt
shows how PyGame displays a movie using moviepy
pygame_nasa-image.txt zeigt mit PyGame das Image of the Day des NASA Earth Observatory
shows NASA Earth Observatory's Image of the Day with PyGame
pygame_plot.txt zeigt, wie PyGame mithilfe von matplotlib.pyplot einen Plot darstellt
shows how PyGame plots a plot using matplotlib.pyplot
pygame_surface-size.txt zeigt die Größe der von PyGame genutzten Fläche (pygame.Surface)
shows the size of the area used by PyGame (pygame.Surface)
pygame_text.txt zeigt, wie PyGame eine Textzeile auf dem Bildschirm darstellt
shows how PyGame displays a line of text on the screen
qrr.txt liest QR-Code aus einer Bilddatei und gibt den entsprechenden Text auf dem Bildschirm aus
reads QR code from an image file and outputs the corresponding text on the screen
qrw.txt schreibt eine Bilddatei mit QR-Code
writes an image file with QR code
requests_bild.txt lädt und zeigt ein Bild (Zeitverlauf des arktischen Meereises) aus dem Internet
loads and shows an image (time history of the Arctic sea ice) from the Internet
requests_cartoon.txt zeigt den neuesten Cartoon der Webseite https://xkcd.com
shows the latest cartoon from the website https://xkcd.com
requests_uniprot-fasta.txt lädt eine Proteinsequenz von der Datenbank UniProt
loads a protein sequence from the UniProt database
scan.txt steuert einen Scanner und speichert das Ergebnis als PDF Datei
controls a scanning device and saves the result in a PDF file
spr.txt wandelt eine kurze Audiodatei in eine Textdatei (mit Google Speech Recognition service)
transcribes a short audio file to text file using Google's Speech Recognition service (via internet)
temp_onewire_plot.txt misst die Temperatur mit DS18S20 und speichert die Temperaturkurve
measures the temperature with DS18S20 and saves the temperature curve
textos.txt spricht eine Textzeile (mit Pythonbibliothek gTTS und Google Text-to-Speech)
speaks a line of text using Python library gTTS and Google Text-to-Speech (via internet)
vlc_radio.txt steuert den Mediaplayer VLC mit drei Tasten über die GPIO eines Raspberry Pi
controls the media player VLC with three buttons via the GPIO of a Raspberry Pi
welt.txt ist ein kleiner Feedreader für einen WebFeed der Zeitung WELT
is a small feed reader for a web feed from the WELT newspaper
ww_easy.txt schreibt mit dem Modul python-docx eine kleine WORD-Datei im Format doc
writes a small formatted text file, where the format is DOC, commonly used with MS WORD
VERALTET: youtube_dl.txt liefert Schnittstelle zu youtube-dl für Download von YouTube-Dateien
OBSOLETE: provides interface to the youtube-dl program for downloading YouTube files