NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
| """ | |
| An examnple of the use of threading to allow simultaneous operations in a | |
| tkinter gui (which is locked to a single thread) | |
| """ | |
| import threading | |
| import tkinter as tk | |
| from tkinter import ttk | |
| package tech.alvarez.today; | |
| import android.content.Intent; | |
| import android.os.Bundle; | |
| import android.support.annotation.NonNull; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.view.View; | |
| import android.widget.ProgressBar; | |
| import android.widget.Toast; |
NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
| #!/bin/bash -e | |
| # /usr/local/sbin/raspi-monitor | |
| # Script to enable and disable the HDMI signal of the Raspberry PI | |
| # Inspiration: http://www.raspberrypi.org/forums/viewtopic.php?t=16472&p=176258 | |
| CMD="$1" | |
| function on { | |
| /opt/vc/bin/tvservice --preferred |
| #!/usr/bin/env python | |
| """ | |
| - read subprocess output without threads using Tkinter | |
| - show the output in the GUI | |
| - stop subprocess on a button press | |
| """ | |
| import logging | |
| import os | |
| import sys | |
| from subprocess import Popen, PIPE, STDOUT |
| public static ISessionFactory SessionFactory { get; private set; } | |
| protected void Application_Start() | |
| { | |
| AreaRegistration.RegisterAllAreas(); | |
| RegisterGlobalFilters(GlobalFilters.Filters); | |
| RegisterRoutes(RouteTable.Routes); | |
| //Configure NHibernate and create a session factory for the application | |
| var nhibernateConiguration = new NHibernate.Cfg.Configuration(); |