Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Tuesday, June 20, 2023

Outlaw Alley: The WANTED Poster Generator !

 Hello, and Welcome to my Blog! 

If you're a returning visitor, sorry I was gone.


Quote of the Week:

You don't have enemies. The truth is that nobody has them.

-Thors

Hello, my loyal followers today! I have an application to show that I've created in preparation for a new event at SUNY Canton. The event's name is the Wild West Fest, and this application is called Outlaw Alley. It took me about 2 weeks to create this program, and it's pretty straightforward to the point even a 5-year-old could use it. 

The application consists of five screens. The title, name prompt, bounty prompt, taking the picture, and restarting. I'll go over a few of them below. The first screen is where the user is first told what they're looking at and actively conveys what the goal of the application is, as seen below.


Please forgive the shotty background, as the webcam is limited at the moment as this is running on a desktop. 😂

I have to give a special thanks to the GitHub user "matthewkayne" for providing the basis for the webcam portion of this project. I edited their source code by adding an additional method to the class for taking a picture and adding it to the Wanted poster.

Then after this screen, you will be prompted to enter your bandit name. I chose to be called 'Ol' Tan' because of the hat I was wearing, and 'Ol' White' might offend some people. Then it asks you to input your bounty. I put in the relatively high number of 10000, and then after submitting the number, you will be asked to take a picture. 


The one portion of taking a picture I'm proud of in this application is that it's nearly instant. This is compared to my previous project, the PPCC, where picture processing was incredibly slow.

After the picture is taken. OpenCV compiles all of the information from the application to generate a Wanted poster!

This is coded in Python and uses three main libraries.

-Tkinter

-OpenCV

-Pillow

The only way at the moment to try this out is to show up at SUNY Canton at the Wild West Fest. I'll be sure to drop more information soon. 

If you would like to test this out at your own event, please contact me at patrickmadon130@gmail.com

That's it for this week. Come back next week for more tech stuff from me.

-PEACE💣

Links Above 

GitHub Link:GreenyPM/OutlawAlley-WildWestFest: This is a WANTED Poster Generator made for the Wild West Fest 2023 (github.com)


Monday, February 20, 2023

Nerd's Hour - A Japanese Gameshow Americanized.

 Welcome to my Blog!


This is Nerd's Hour a Game Show that will Appear at the Comic-Con!

So first ahhhhhh IT'S CRAZY THAT I'M RUNNING A GAME SHOW, RIGHT? Oh, before I forget and start rambling with code here's your quote of the week.

Quote of the Week:
A dollar makes me holler!

-A Sorority Girl at the Cookie Sale.

Hello everyone; welcome back to my blog. I've decided to continue my non-voluntary strike of learning C++ and do actual projects in Python with Tkinter. The picture above is my game show's layout board or main menu. I got the idea for it while attending a Comic-Con in Canada. The land of the maple syrup that I love so much (I'm American).


The game works as follows. There are ten panels on the board, and a contestant comes up to the board and chooses one. After choosing one, they are prompted with any of the following categories.


Trivia - Audio Question - Guess that Silhouette - Videogame Challenge - Brutal Question


If they get the question right, they get a point, and the block disappears. They then move on to choose another question on the board. Until they get a question wrong, they will "lose their streak," as I like to say. If they had the highest streak, they stay up top on the "Winner's Couch". This is until someone beats their streak. If their streak gets beaten, they get kicked off the couch but sent away with some prizes. The whole goal is to stay on the sofa till the end of the show, so you can get the Grand Prize, which I will keep a secret for now 🤐.


Some people may say people are going to metagame and wait till the last minute to steal it away...

You'd be right if I were planning on handpicking people. This game's contestants will be chosen out of entire chance. Every audience member will be given a card with a number on it. Then I'll pull a random number within that range from a python script. It will look somewhat simple like this:


import random


maxValAudience = int(input())


print(random.randint(0,maxValAudience+1))


*Kids and Adults at home, this simple Python code can be used! (on the house 😉)



This will give everyone an equal chance to participate in the competition. Now as I said in the beginning, I did promise I'd write about the code. Here's your fix code heads. This is made up of 4 Python using the Pandas, Tkinter, and OpenCV libraries. I'll only show you a snippet of them for right now so as not to spoil all the questions for anyone participating in the show. If you'd like to purchase the rest, please refer to my email "patrickmadon130@gmail.com".


Snippet from ques.py
#This is where the information for the question contents and the button commands lie.
from tkinter import *
import pandas as pds
import Counter
import musicShadows
import os


def quesSel(Cbutton,number):


successVal = "Correct!"
failVal = "Wrong."
button1x = 1300
button1y = 550
button2y = 700

ques = Tk()
ques.title("Question")
ques.attributes('-fullscreen', True)
ques.config(background='Black')
ques.resizable(False, False)

if number == 0: #Trivia
file = "TriviaQuestions.xlsx"
fr = open("Counters\\trivia.txt")
value = int(fr.read())
fr.close()
imageref = musicShadows
# Read Excel and select a single cell (and make it a header for a column)
Ques = pds.read_excel(file, 'Sheet1', index_col=None, usecols="A", header= value,nrows=0)
choices = pds.read_excel(file, 'Sheet1', index_col=None, usecols="B", header= value, nrows=0)
Qvalue = Ques.columns.values[0] # this must always be at 0
Cvalue = choices.columns.values[0]
# Title
C = Canvas(ques, bg="#d0c0cc", height=500, width=1500)
C.place(x=10, y=10)
titleText = Label(ques, text="Trivia Question!", fg = "Green",font=('Californian FB', 80), bg="White")
titleText.place(x=10, y=40)
questionText = Label(ques, text=Qvalue, font=('Helvetica', 50), bg="#d0c0cc")
questionText.place(x=10, y=180)

# Text
qBox = Canvas(ques, bg="grey", height=300, width=1250)
qBox.place(x=20, y=550)
questionText = Label(ques, text=Cvalue, font=('Helvetica', 30), bg="grey")
questionText.place(x=30, y=580)

#Real Answer
# Reveal Button
reveal = Button(ques, text="Reveal", font=('Helvetica', 15), height=5, width=20, command=lambda
: imageref.revealAns(value,ques,file))
reveal.place(x=1000, y=550)


Here's a Picture of the one of the question prompts.


Hopefully, this week, I'll be working on structures of C++ again, but I hope you enjoyed a little showcase of my new project! Any feedback would be greatly appreciated, as long as it's constructive.

Until Next Time, Peace! 💣

DOCTOR! The Calculator is Terminal!! The C++ variety ;)

    Hello, and Welcome to my Blog!  If you're a returning visitor, ...Hello Again! Quote of the Week: ..but fear itself isn't worthy...