コード例 #1
0
# scrap requires a total of three lines of python code for you to use
# this example shows how scrap can be called manually

import scrap  # this needs to be done on every script you write to a scrap from

### Link this folder to a scrap key
# This command only needs to be invoked once for each project directory you work in - it will save the key to a file for use going forward
# but there's no harm in running it each time if you prefer - it will overwrite nicely
scrap.setup("scrap-testing")

# If you want to then you can add a line divider to make it easier to see where each new code run startds
scrap.new_section()

# Then you write to your scrap with the following command:
scrap.write("Hello world")

# It will appear immediately at your scrap on the web

# That's all

print("A string has been written to " + scrap.get_key_from_file())
print("Go check it out at https://scrap.rest/read?key=" +
      scrap.get_key_from_file())
コード例 #2
0
except ImportError:
    print(
        "Backlight control not available, please install the 'rpi_backlight' Python package: https://github.com/linusg/rpi-backlight#installation"
    )
    backlight = None
else:
    backlight = Backlight()

## Remote debug mode - only activate if you are experiencing issues and want the developer to help
remote_debug_key = ""
if remote_debug_key != "":
    print(
        "Remote debugging being set up - waiting 10 seconds for wifi to get working"
    )
    time.sleep(10)
    scrap.setup(remote_debug_key)
    scrap.auto_scrap_on_print()
    scrap.auto_scrap_on_error()
    scrap.new_section()
    scrap.write("App start")

###############################################################################
# Parameters and global variables

# set user variables
thumbsize = 600, 600  # pixel size of thumbnail if you're displaying detail
screensize = 720, 720  # pixel size of HyperPixel 4.0
fullscreen = True

# Declare global variables (don't mess with these)
root = None
コード例 #3
0
# scrap requires a total of three lines of python code for you to use

import scrap  # this needs to be done on every script you write to a scrap from

### Link this folder to a scrap key
# This command only needs to be invoked once for each project directory you work in - it will save the key to a file for use going forward
# but there's no harm in running it each time if you prefer - it will overwrite nicely
scrap.setup("black-ferret")

# Then you write to your scrap with the following command:
scrap.write("Hello world: colon and")

# It will appear immediately at your scrap on the web

# That's all


print ("A string has been written to " + scrap.get_key_from_file())
print ("Go check it out at http://scrap.hankapi.com/read?key=" + scrap.get_key_from_file())