|
import streamlit as st |
|
import pandas as pd |
|
import folium |
|
from streamlit_folium import folium_static |
|
import extra_streamlit_components as stx |
|
|
|
|
|
|
|
|
|
st.set_page_config(page_title="Wild Bill vs Buffalo Bill", page_icon="๐ค ", layout="wide") |
|
|
|
|
|
if 'page' not in st.session_state: |
|
st.session_state.page = 'home' |
|
|
|
|
|
def get_manager(): |
|
return stx.CookieManager() |
|
|
|
cookie_manager = get_manager() |
|
|
|
|
|
wild_bill_story = """ |
|
# ๐ซ Wild Bill Hickok: The Legendary Gunslinger |
|
|
|
## 1. ๐ Early Life |
|
- ๐ผ Born James Butler Hickok on May 27, 1837, in Homer, Illinois |
|
- ๐พ Grew up on a farm, developing skills in shooting and horseback riding |
|
- ๐๏ธ Left home at 18 to become a stagecoach driver on the Santa Fe Trail |
|
|
|
## 2. ๐ฆธโโ๏ธ Rise to Fame |
|
- ๐ฎ Became a lawman in Kansas and Nebraska territories |
|
- ๐ฏ Earned reputation as a skilled marksman and gunfighter |
|
- ๐ฐ Featured in dime novels, spreading his fame across the country |
|
|
|
## 3. ๐๏ธ Notable Locations |
|
- ๐ฝ Rock Creek Station, Nebraska: Site of the McCanles Massacre (1861) |
|
- ๐ Abilene, Kansas: Served as city marshal (1871) |
|
- ๐๏ธ Cheyenne, Wyoming: Brief stint as sheriff (1876) |
|
|
|
## 4. ๐ The Fateful Day: August 2, 1876 |
|
- ๐ Playing poker in Nuttal & Mann's Saloon, Deadwood |
|
- ๐ซ Shot in the back of the head by Jack McCall |
|
- ๐๏ธ Holding the famous "Dead Man's Hand" - aces and eights |
|
""" |
|
|
|
buffalo_bill_story = """ |
|
# ๐ฆฌ Buffalo Bill Cody: The Showman of the West |
|
|
|
## 1. ๐ Early Life |
|
- ๐ผ Born William Frederick Cody on February 26, 1846, in Le Claire, Iowa |
|
- ๐ Began riding horses at a young age |
|
- ๐ Worked as a Pony Express rider at age 14 |
|
|
|
## 2. ๐ Rise to Fame |
|
- ๐ฆฌ Earned nickname "Buffalo Bill" as a buffalo hunter for the railroad |
|
- ๐๏ธ Served as a scout for the U.S. Army during Indian Wars |
|
- ๐ฐ Became famous through dime novels about his exploits |
|
|
|
## 3. ๐ช Buffalo Bill's Wild West Show |
|
- ๐ค Created the famous traveling show in 1883 |
|
- ๐ Toured across America and Europe |
|
- ๐น Featured Native Americans, cowboys, and sharpshooters |
|
|
|
## 4. ๐
Legacy |
|
- ๐๏ธ Founded the town of Cody, Wyoming |
|
- ๐๏ธ Advocated for conservation of the American West |
|
- ๐ญ Shaped the world's perception of the American frontier |
|
""" |
|
|
|
|
|
def home(): |
|
st.title("๐ค Wild Bill Hickok vs Buffalo Bill Cody: A Tale of Two Western Legends") |
|
st.write("Welcome to our interactive dime novel! Choose a character to explore their story.") |
|
|
|
|
|
def wild_bill(): |
|
st.title("๐ซ Wild Bill Hickok: The Legendary Gunslinger") |
|
st.markdown(wild_bill_story) |
|
|
|
|
|
def buffalo_bill(): |
|
st.title("๐ฆฌ Buffalo Bill Cody: The Showman of the West") |
|
st.markdown(buffalo_bill_story) |
|
|
|
|
|
chosen_id = stx.tab_bar(data=[ |
|
stx.TabBarItemData(id="home", title="Home", description="Start here"), |
|
stx.TabBarItemData(id="wild-bill", title="Wild Bill", description="Explore Wild Bill's story"), |
|
stx.TabBarItemData(id="buffalo-bill", title="Buffalo Bill", description="Discover Buffalo Bill's adventures"), |
|
], default="home") |
|
|
|
|
|
if st.session_state.page != chosen_id: |
|
st.session_state.page = chosen_id |
|
st.rerun() |
|
|
|
|
|
cookie_manager.set("last_page", chosen_id) |
|
|
|
|
|
st.sidebar.write(f"Last visited: {cookie_manager.get('last_page')}") |
|
|
|
|
|
if st.session_state.page == 'home': |
|
home() |
|
elif st.session_state.page == 'wild-bill': |
|
wild_bill() |
|
elif st.session_state.page == 'buffalo-bill': |
|
buffalo_bill() |
|
|
|
|
|
story_progress = stx.stepper_bar(steps=["Early Life", "Rise to Fame", "Notable Feats", "Legacy"]) |
|
st.sidebar.info(f"Story Progress: Phase #{story_progress}") |
|
|
|
|
|
st.subheader("๐บ๏ธ Journey Through the Wild West") |
|
m = folium.Map(location=[41, -100], zoom_start=4) |
|
|
|
|
|
locations = [ |
|
("Homer, IL", 40.0356, -87.9506, "Wild Bill's first rodeo (birthplace)"), |
|
("Rock Creek Station, NE", 40.1116, -97.0564, "Wild Bill's wild time (McCanles Massacre)"), |
|
("Abilene, KS", 38.9172, -97.2137, "Wild Bill's badge-wearing days"), |
|
("Cheyenne, WY", 41.1400, -104.8202, "Wild Bill's brief sheriff showdown"), |
|
("Deadwood, SD", 44.3767, -103.7296, "Wild Bill's last poker game ๐ข"), |
|
("Le Claire, IA", 41.5978, -90.3485, "Buffalo Bill's first 'Yee-haw!' (birthplace)"), |
|
("North Platte, NE", 41.1239, -100.7654, "Buffalo Bill's home on the range"), |
|
("Cody, WY", 44.5263, -109.0565, "Buffalo Bill's namesake town (no buffaloes were harmed)"), |
|
("Denver, CO", 39.7392, -104.9903, "Buffalo Bill's final bow ๐ญ") |
|
] |
|
|
|
|
|
for name, lat, lon, desc in locations: |
|
folium.Marker( |
|
[lat, lon], |
|
popup=f"{name}: {desc}", |
|
tooltip=name |
|
).add_to(m) |
|
|
|
|
|
folium_static(m) |
|
|
|
|
|
st.subheader("๐ Side-by-Side Comparison") |
|
comparison_data = { |
|
"Aspect": ["Birth Year", "Death Year", "Nickname Origin", "Primary Occupation", "Famous For", "Colorado Connection", "South Dakota Connection"], |
|
"Wild Bill Hickok": ["1837", "1876", "Unclear, possibly his wild nose ๐", "Lawman, Gunfighter", "Quick Draw McGraw IRL", "Visited (probably for the beer ๐บ)", "Died in Deadwood (worst poker game ever)"], |
|
"Buffalo Bill Cody": ["1846", "1917", "Buffalo hunting (not actual buffaloes)", "Showman, Scout", "Wild West Show (wilder than spring break)", "Home in Denver (loved the mountains)", "Performed shows (to rival Deadwood's saloons)"] |
|
} |
|
|
|
|
|
df = pd.DataFrame(comparison_data) |
|
st.table(df) |
|
|
|
|
|
st.markdown(""" |
|
## ๐
Conclusion: Legends of the West |
|
|
|
Yeehaw! We've corralled the tales of two of the wildest cowboys to ever roam the American frontier! ๐ค |
|
|
|
- ๐ซ **Wild Bill Hickok**: The man, the myth, the mustache! He lived fast, died young, and left a good-looking corpse (with a really bad poker hand). |
|
|
|
- ๐ช **Buffalo Bill Cody**: The original showman who put the 'wild' in Wild West! He turned frontier life into a circus... literally! |
|
|
|
These two buckaroos shaped the West faster than a tumbleweed ๐ฟ rollin' in a tornado! Their legacy is as enduring as the smell of a cowboy's boots after a long cattle drive. ๐๐จ |
|
|
|
So next time you're sipping sarsaparilla ๐ฅค in a saloon, tip your hat ๐ค to Wild Bill and Buffalo Bill - the OG influencers of the American West! |
|
|
|
Remember, in the words of the great philosopher Woody from Toy Story: "There's a snake in my boot!" ๐๐ข (Okay, maybe that's not relevant, but it's still a great quote!) |
|
""") |
|
|
|
|
|
st.sidebar.markdown("---") |
|
st.sidebar.markdown("Created with โค๏ธ and a lot of ๐ค using Streamlit") |