# Making Hangman Game in Processing.py

**URL:** <https://discourse.processing.org/t/making-hangman-game-in-processing-py/30495>\
**Category:** Processing.py\
**Created:** [June 4, 2021, 5:27pm UTC](https://discourse.processing.org/t/making-hangman-game-in-processing-py/30495 "2021-06-04T17:27:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SilentStorm](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@SilentStorm](https://discourse.processing.org/u/SilentStorm)\
**Post date:** [June 4, 2021, 5:27pm UTC](https://discourse.processing.org/t/making-hangman-game-in-processing-py/30495/1 "2021-06-04T17:27:13Z")

</div>

Hey all, so I’m trying to make a Hangman game in Processing.py and have written code for both how I want it to look, as well as separate code to run the game. The problem is combining the two in Processing. Is there a way to make a Hangman game with Processing.py? Or am I just wasting my time? Thanks in advance to all that help.

Code for Hangman game (non-processing)

```auto
import time
import random
name = input("What is your name? ")
print ("Hello, " + name, "Time to play hangman!")
print ('')
time.sleep(2)
print ("Start guessing...")
bank = ["ironman", "hulk", "captain america", "black widow", "thor", "hawkeye"]
r = (random.randint(0,5))
word = bank[r]
guesses = ''
turns = 10
while turns > 0:         
    failed = 0             
    for char in word:      
        if char in guesses:    
            print (char, )
        else:
            print ("_", )   
            failed += 1
    if failed == 0:
        print ("You won")  
        break              
    print
    guess = input("guess a character:") 
    guesses += guess                    
    if guess not in word:  
        turns -= 1        
        print ("Wrong")   
        print ("You have", + turns, 'more guesses' )
        if turns == 0:           
            print ("You Lose")

```

Code for Hangman visuals (Processing)

```auto
def setup():
    size(250,350)
    background(102,204,255)
    fill(17,214,11)
    rect(0,201,250,350)
   
def draw():
    strokeWeight(2)
    line(100,100,100,200)
    line(100,100,150,100)
    line(150,100,150,125)
    line(75,200,125,200)
    line(85,200,100,175)
    line(115,200,100,175)

```

---

<div class="post-metadata">

**Author:** ![tabreturn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tabreturn/32/3697_2.png) [@tabreturn](https://discourse.processing.org/u/tabreturn)\
**Post date:** [June 5, 2021, 8:33pm UTC](https://discourse.processing.org/t/making-hangman-game-in-processing-py/30495/2 "2021-06-05T20:33:04Z")

</div>

This is a duplicate topic: [How to make hangman in Processing.py](https://discourse.processing.org/t/how-to-make-hangman-in-processing-py/30499/)
