Giter Club home page Giter Club logo

cardstock's Introduction

CardStock

About

CardStock is a cross-platform tool for quickly and easily building graphical programs, called stacks, which can be made up of multiple pages called cards. It provides a drawing-program-like editor for building Graphical User Interfaces, and a code editor for adding event-driven python code.

Pong example

There have been many open source projects in the past that tried to capture the fun and simplicity of building programs in HyperCard, but in my opinion, none of them offered the open-ended possibilities and ease of use that made HyperCard such a magical-feeling tool. So in the grand open source tradition, I built my own.

The guiding principles behind my vision for CardStock are the following, in order of importance:

  1. Keep it approachable, understandable, simple, and efficient to use for python beginners, through the most salty of Senior Software Engineers.
  2. Make it as capable as possible, without adding unnecessary complexity.

Features

The Basics

  • CardStock lets you design stacks on MacOS, Windows, and GNU/Linux. You can run CardStock stacks on those platforms, or on any modern web browser, include on Chromebooks and smartphones.
  • You can build programs using objects including text and graphics, images, buttons, text entry fields, and web views.
  • You can use your own python code to manipulate the objects and respond to mouse and keyboard events.
  • You can play sound files from your code.
  • You can search and use clip art in your stacks, thanks to integration with https://openclipart.org.
  • In-context help appears in the app, right where you need it. And can be turned off when you no longer want it taking up space.
  • All of the creature comforts you've come to expect from a proper application, like full Undo/Redo, and a Find/Replace system that works throughout all of your code and object properties.

More Advanced

  • You can animate changes to most properties of objects, to bring your creations to life.
  • Objects can have speed, and can be set up to automatically bounce off of other objects.
  • You can import other python modules into your code, and use them make web requests and display the results, control robots, or run machine learning code, all from within your CardStock stack.
  • Basic IDE features, like syntax highlighting, underlining syntax errors while editing, and autocomplete for objects, variables, functions, methods, properties.
  • Run python commands in an interactive Console window while your stack runs, to check or set variable values, call functions, or any other python you want to run.
  • Browse your running stack's variables and objects, and modify them live in the Variables window.
  • View all code used in a whole stack in one place, and click a line to jump to that line in that object's code editor for that event.
  • View recent error messages, and click one to jump to the offending line of code in the Designer.
  • You can export a stack into a standalone application that you can share and distribute, or upload it to the web, on https://cardstock.run.

Future Plans

  • Add a built-in library of sounds to use, and the ability to record your own sounds.
  • Allow looping sounds, and playing synthesized notes.
  • Add more tutorials for CardStock, and for learning python through CardStock.
  • Allow filling shapes with color gradients.
  • Add app icons for the CardStock Designer and Viewer.
  • Improve bounce physics and collision detection performance.

Known Issues

  • TextFields, and WebViews always remain in front of shapes and images, which get drawn directly on the card view.
  • Visual selection indicators (the blue dotted outlines) are drawn behind native views, and so can hide behind overlapping text fields and web views.
  • Stacks can only import additional modules, and export stacks that include them, when running from source. Not when running from the prebuilt applications. (The prebuilt applications are built with a few additional libraries: requests, pyserial, and more could be added by request.)
  • Ironically, WebViews do not work in the web-based viewer on https://cardstock.run.
  • For performance reasons, currently mouse events don't propagate through all overlapping objects when running on the web-viewer, just the topmost object under the mouse, any containing groups, and the card.

Requirements

The prebuilt applications for Mac and Windows have no external dependencies.

Running CardStock from source requires Python 3.7 or newer (3.11 recommended), and wxPython 4.1 or newer (wxPython 4.2.x recommended). CardStock requires installing the python modules attrdict3(linux-only), wxpython, simpleaudio, PyInstaller, and requests.
For mp3 playback support, you'll need to install the lame package (mp3 decoder), and python's streamp3. Note that Python 3.12 is currently incompatible with wxpython, and so will not run CardStock until wxPython receives an update.

Installation

You can either:

1. Run it from source:

  1. install python3 # Note: Python3.12 is incompatible with wxpython, so 3.11 is recommended

  2. Linux-only: apt install libasound2-dev lame libwebkit2gtk-4.0-dev # or equivalent on non-debian/ubuntu distros

  3. Mac-only: brew install lame

  4. pip3 install attrdict3

  5. pip3 install wxpython PyInstaller simpleaudio requests # note that wxpython can take a long time to build

  6. To include mp3 support: pip3 install streamp3

    (Note that this may require setting LDFLAGS and CPPFLAGS to allow finding the lame header and library files.

    You may need to run this as something like

    CPPFLAGS=-I/opt/homebrew/include LDFLAGS=-L/opt/homebrew/lib pip3 install streamp3 or

    CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib pip3 install streamp3

    depending on where the lame library was installed.)

  7. download or clone this repository

  8. run designer.py and viewer.py as desired

  9. optionally run build.py to create your own standalone applications for the Designer and Viewer applications.

2. Install using pip/pypi:

  1. Linux-only: apt install libasound2-dev lame libwebkit2gtk-4.0-dev # or equivalent on non-debian/ubuntu distros

  2. Mac-only: brew install lame

  3. To include mp3 support: pip3 install streamp3

    (Note that this may require setting LDFLAGS and CPPFLAGS to allow finding the lame header and library files.

    You may need to run this as something like

    CPPFLAGS=-I/opt/homebrew/include LDFLAGS=-L/opt/homebrew/lib pip3 install streamp3 or

    CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib pip3 install streamp3

    depending on where the lame library was installed.)

  4. pip3 install cardstock # note that the dependency wxpython can take a very long time to build

  5. run using the newly installed commands cardstock and cardstock_viewer

3. Or download the latest, pre-built CardStock application for Mac or Windows

  1. Download CardStock for Mac or Windows here: https://github.com/benjie-git/CardStock/releases/latest
  2. Note that the pre-built Windows app is not yet code-signed, so Windows will complain the first time you open the app. If a window appears saying "Windows protected your PC", click the More Info link at the end of the warning paragraph, and then the "Run Anyway" button that appears at the bottom of the window.

Reference

cardstock's People

Contributors

benjie-git avatar blingdahl avatar kball avatar unendiverse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cardstock's Issues

BUG: Locale error

The program (pyinstaller version) does not open a window. The process is running but there are no open windows.
OS: Windows 10 build 1909

Consider auto-resizing text boxes

I noticed watching my boys play with this that they both got confused/frustrated by typing into a text box and having the text not all be visible.

I wonder if would be worth making the text labels auto-resize, either by autogrowing the box, or by automatically shrinking the font size to fit in the visible box (similar to keynote). We could still allow deliberate manipulation of the properties that override this auto scaling.

App does not do anything when exporting to duplicate name

Steps to reproduce:

  1. Open CardStock_Designer.app
  2. Open an example stack
  3. File | Export Stack
  4. Export as App
  5. Save in Downloads
  6. File | Export Stack
  7. Save in Downloads

Expected:
Prompts for whether you want to overwrite

Actual:
Export does not do anything

Mac Sonoma: App does not run due to new security setting

After installing pip install cardstock, trying to run cardstock in terminal results in this message:
Python[61225:7000989] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.

Have not looked deeper, but seems to be a recent issue caused by the latest MacOS update. Could not find a related issue reported for wxPython (yet?).

Can't get app to build

System Config

2020 M1 Mac Mini
16GB RAM
Python 3.11.7

Problem Description

Cannot build app from repo

Steps to recreate

  1. Clone app from repo
  2. Install dependencies (wxpython PyInstaller simpleaudio requests)
  3. Change to cardstock directory
  4. python designer.py

Error Log

Traceback (most recent call last):
  File "/Users/chuck/fiddle/code/CardStock/cardstock/designer.py", line 27, in <module>
    from viewer import ViewerFrame
  File "/Users/chuck/fiddle/code/CardStock/cardstock/viewer.py", line 27, in <module>
    from runner import Runner
  File "/Users/chuck/fiddle/code/CardStock/cardstock/runner.py", line 28, in <module>
    from streamp3 import MP3Decoder
ModuleNotFoundError: No module named 'streamp3'

When attempting to install streamp3:

pip install streamp3 2>build.log 
Collecting streamp3
  Using cached streamp3-0.1.12.tar.gz (10 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting Cython==0.29.34 (from streamp3)
  Using cached Cython-0.29.34-py2.py3-none-any.whl (988 kB)
Building wheels for collected packages: streamp3
  Building wheel for streamp3 (pyproject.toml) ... error
Failed to build streamp3

Error Log

error: subprocess-exited-with-error

  × Building wheel for streamp3 (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [7 lines of output]
      /private/var/folders/46/js_q6q9n6555jsbl_23gzx7w0000gn/T/pip-build-env-v1ij8rns/overlay/lib/python3.11/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /private/var/folders/46/js_q6q9n6555jsbl_23gzx7w0000gn/T/pip-install-8nnx7fp8/streamp3_cda0fbf45c564c8591a36ffe6136cdbf/lame/hip.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      lame/hip.c:750:10: fatal error: 'lame/lame.h' file not found
      #include <lame/lame.h>
               ^~~~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for streamp3
ERROR: Could not build wheels for streamp3, which is required to install pyproject.toml-based projects

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.