Skip to content

Instantly share code, notes, and snippets.

@hawkz
Created January 25, 2023 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hawkz/29b92d200fcd8c11178e4d05e745af94 to your computer and use it in GitHub Desktop.
Save hawkz/29b92d200fcd8c11178e4d05e745af94 to your computer and use it in GitHub Desktop.
A mockup of a beginner pypercard
def MyCard(Pypercard):
# setup card - let me change the background on the card, maybe dimensions.
styles = "css reference or raw css here"
# django model-like element definitions
hero_image = card.image('url to image') # styles could reference MyCard.hero_image
card_title = card.text('You enter the jungle') # same styles effect, maybe magic for page title??
description = card.text('You see a glowing orb, what do you do?')
choose_left = card.button('Choose left') # clickable button, magics up event below
choose_orb = card.button('Look at the orb')
# events
def hero_image_hover(event): # not sure on this syntax
# switch the image for a flickering orb
MyCard.hero_image.src = 'alt image'
# could do style changes here maybe... or just have magic classes applied on hover...
def choose_left.click(event):
MyOtherCard.navigate() # takes me to a new card
def choose_orb.click(event):
if self.text == "Look at the orb":
Character.items.append('orb') # access element/variable on another card
MyCard.hero_image.src = "url of hand holding image"
Mycard.choose_left.disable()
Mycard.choose_orb.text = "Explore further"
else:
MyOtherCard.navigate() # takes me to a new card
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment