Skip to content
Permalink
f57ee6cd0e
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
348 lines (253 sloc) 17.8 KB
from tkinter import *
master = Tk()
window = Canvas(master, width=1000, height=1000)
window.pack(fill=BOTH, side=LEFT)
def clear():
window.delete("all")
def textToCanvas(quote, w, h):
clear()
window.create_text(w, h, text=quote, anchor=CENTER)
def secret():
textToCanvas("You've found the end!!!", 500, 200)
def festival():
textToCanvas("""The festival was beautiful: lights shining everywhere, traditional dancing and music
from as far as the eye could see.""", 500, 200)
canvasChoiceButton("Visit other sights", citySights, 800, 400)
def party():
textToCanvas("""Ricardo went inside and saw the beautiful golden interior.
It must’ve been redesigned – robots raced across the floors to deliver
food to esteemed guests, dragons would fly across the room and refill glasses
and cup. It was fascinating.""", 500, 200)
canvasChoiceButton("Visit other sights", citySights, 800, 400)
def uenoParkAndZoo():
global ueno
ueno = True
textToCanvas("""\nHe travelled to Ueno Park and zoo. The greenery was astoundingly serene, covering the whole park.
The zoo was filled with animals from all around the globe including polar bears, African elephants and camels.""", 500, 200)
canvasChoiceButton("Visit other sights", citySights, 800, 400)
def sensojiTemple():
global sensoji
sensoji = True
textToCanvas("""\nSensō-ji Temple was a masterpiece and also Tokyo’s most famous shrine. The Asakusa district was
famous for its various festivals such as the Sanja Matsuri.""", 500, 200)
canvasChoiceButton("Go to festival", festival, 600, 400)
canvasChoiceButton("Visit other sights", citySights, 800, 400)
def westernArt():
global western
western = True
textToCanvas("""The National Museum of Western Art was going to be very weird and wonderful. Comparing 1950s
New York to the items on display in this museum would be fun to see. Over 100 years worth of knowledge was
stored in these display cabinets. He saw the newspaper he had read the day he first used the time machine.
He was impressed by the way Japan had developed so fast; collecting all these old items whilst simultaneously
expanding on their technological front.""", 500, 200)
canvasChoiceButton("Visit other sights", citySights, 800, 400)
def natureAndScience():
global nature
nature = True
textToCanvas("""He decided to visit the National Museum of Nature and Science and compare his
notes to the historian’s views on the ancient world. There were hundreds of artifacts and
trinkets and so far, the historians and had got most of it bang on.""", 500, 200)
canvasChoiceButton("Visit other sights", citySights, 800, 400)
def imperialPalace():
global palace
palace = True
textToCanvas("""The Imperial Palace was his best bet to see what had changed.
Crossing the Seimon Ishibashi bridge, he found the Emperor of Japan welcoming guests
into his hall. There must’ve been a party; why not go and relax after all the hard
work?""", 500, 200)
canvasChoiceButton("Go to party", party, 600, 400)
canvasChoiceButton("Visit other sights", citySights, 800, 400)
def citySights():
textToCanvas("""There are so many sights and scenery in Tokyo so theres so much to see and do.
Go visit the Imperial Palace?
Go visit the National Museum of Nature and Science?
Go visit the National Museum of Western Art?
Go visit the Sensō-ji Temple?
Go visit the Ueno Park and Zoo?
Where should he visit? """, 500, 200)
canvasChoiceButton("Imperial Palace", imperialPalace, 200, 400)
canvasChoiceButton("Museum of Nature and Science", natureAndScience, 400, 400)
canvasChoiceButton("Museum of Western Art", westernArt, 600, 400)
canvasChoiceButton("Sensō-ji Temple", sensojiTemple, 200, 600)
canvasChoiceButton("Ueno Park and Zoo", uenoParkAndZoo, 400, 600)
if palace and nature and western and sensoji and ueno:
canvasChoiceButton("Secret", secret, 600, 600)
def tokyo():
global palace
global nature
global western
global sensoji
global ueno
palace = False
nature = False
western = False
sensoji = False
ueno = False
textToCanvas("""He still hasn’t found a way to fix the machine, he travels to Tokyo to meet a friend who can try to help him,
when he arrives in Tokyo he saw that technology was superior to new York and he thought “How will Tokyo be in 2090?”.
Five years later he finds a way to fix the time machine and he started preparing to travel to Tokyo 2090.
Ricardo landed in Tokyo, 2090. From being a technological powerhouse at the start of the 21st century, Tokyo is now
the largest and most dominant capital globally, thanks to their investment in the science area. Everything is
very accessible and developed, both economically and infrastructurally. From the road markings to the
gigantic billboards present in every uber, the streets are full of LEDs everywhere, even more than before
Some people dislike it and say it's ugly and visual pollution, while others love it and find it fascinating.""", 500, 200)
canvasChoiceButton("He decided to take in the views of the city whilst he was there", citySights, 800, 400)
def timeTravel2():
textToCanvas("""After he uses the time machine for the second time, he arrives in New York in the 21st century.
He saw so many things differently, at the start he was excited because it was everything new and they have so many
things to learn. In the 21st century, the technology is massive they have self-driving cars, pervasive smartphones,
hoverboards, household robots that clean, cook and practically can do everything and he wants to learn how things do
what they do. He was a little bit lost at the beginning, but he was willing to learn everything, so he starts working
at a bar to learn their language and their costumes. One year later he starts to learn more about the technology around
him and he starts to understand how machines do what they do. He reaches a point when he is working at a big technology
company in New York, he bought a new house a good car but he was not satisfied. It felt like something was missing but
he doesn’t know why...
Maybe he already learnt everything he wanted at the 21st century.
When Ricardo realized that a time travel with the time machine requires a real variety of resources he noticed
that the several travels he made had already drained its batteries and it needs recharging, but plutonium
(the main source of energy) is not so easy to find in the present period. After some thinking Ricardo came up with
two ideas for completing his plan to travel in time and space.While the first idea he had was great and would
probably worked well he chose the second idea.He starts to create his technology and try to improve the time
machine so he can go wherever he wants and the time he wants.""", 500, 200)
canvasChoiceButton("20 years have passed", tokyo, 800, 400)
def timeTravel1():
textToCanvas("""He went back to the virtual cave and sat down on the mighty chair and whizzed back to the initial location.
His Era. He had travelled more than 1000 years in history, and he realized that he could learn new things, travel from
year to year, whenever he wanted and become the most knowledgeable man ever.He grabbed a sheet and a pen and started
writing everything he didn’t know and tried to draw them to compare the differences between the evolutions of the years.
He started by designing the wide roads, following the big constructions that he ended up realizing was where people had
their homes, but even so, he still did not realize what was the means of transport that people used""", 500, 200)
canvasChoiceButton("He then travels again", timeTravel2, 800, 400)
def goBackHome():
textToCanvas("""He comes back and shares his discovery and use it for good.""", 500, 200)
canvasChoiceButton("Continue", timeTravel1, 800, 400)
def stayInEra():
textToCanvas("""He enjoys a luxurious life years to come. Evolve and live better and advanced life without family.
Always having the guilt of leaving the family in other era.""", 500, 200)
canvasChoiceButton("Continue", timeTravel1, 800, 400)
def moveOn():
textToCanvas("""Do you want to stay in this era or leave and go back home?""", 500, 200)
canvasChoiceButton("Stay in this era", stayInEra, 700, 400)
canvasChoiceButton("Go back home", goBackHome, 800, 400)
def readNews():
textToCanvas("""The following events occurred in 19th September 1950
In a vote of confidence in the British House of Commons, the Labour government of
Prime Minister Clement Attlee was sustained by a margin of only six votes, 306 to 300.
Some of the Labour Party MPs, absent because of illness, were brought in by the party so that they
could vote.
The European Payments Union was created, for the benefit of fifteen Western European nations,
to stabilize their currencies. The United States contributed $350,000,000 to the endowment fund.
A the opening of the fifth annual session of the United Nations General Assembly, the United States,
United Kingdom and France sent word to the Soviet Union, that an attack by any nation on West Berlin,
or on West Germany, would be considered an act of war against the three Western powers.
The UN General Assembly voted 33-6 to reject a proposal to expel the Republic of China
(located on the island of Taiwan) and to replace representation of the Chinese people with a
delegation from the Communist government of the People's Republic of China.
The musical film The Toast of New Orleans starring Mario Lanza, Kathryn Grayson and David Niven
premiered in New Orleans.""", 500, 200)
canvasChoiceButton("Move on", moveOn, 800, 400)
def holograph():
textToCanvas("""...A black holographic screen appeared towards his face displaying numerous years and
locations and despite being very confused and clueless by everything that was happening, moving his
arm to find answer to feed his curiosity he accidentally pressed the button ‘Year 1900-2000’.
Automatically, he vanished in thin air abruptly, swallowing him up like a deadly python.
Within second he popped back to the chair like an magician.
When he found himself, he was sweating profusely, and in shock, regretting the journey.
Petrified with fear, in a matter of seconds, he left a cave for something that seemed to be wide roads.
He looked around swiftly, rotating his head like spinning ball- it was all new to him.
Huge constructions and building, people dressed in different fashion, very loud and busy.
He accidentally tripped on coco cola glass bottle, nearly hurt him.
He couldn’t wrap his mind around to what happened to him. Everything was seemingly bizarre to him.
Vehicles beeping at each other, people yelling at each other, raining rapidly.
The method of transportation was no longer completed on carts, he didn’t even see a horse and that was
when he realized that he had travelled in time. Gobsmacked, worried for his life, he felt lost and he
didn’t know where he was. Finally he searched for answers, he decided to ask the first person who
passed him where he was and what year he had travelled in time, surprisingly the person laughed at
him and went passed him. He then noticed a man selling newspapers, he noticed the name and date on
the front cover of one of the newspapers being sold.
'News London - 19th of September 1950'
Overwhelmed with emotion, he realised he made the best discovery of his life. He was contemplating as
to what he should do next.
Do you choose to read the News or Move on?""", 500, 200)
canvasChoiceButton("Read the news", readNews, 700, 400)
canvasChoiceButton("Move on", moveOn, 800, 400)
def getToSafety():
textToCanvas("""He felt helpless but couldn’t save his brother. With loss of his brother, he sorrowed on
the shore of a small island he couldn’t look anywhere but to deep sea that swallowed his little
brother. After some time, his one brother said “it's not over” then he remembers that at least he
should try to save others.
They saw huge mountain in the middle. He had never seen anything like it before and thought of
climbing to the top so they can try to set fire on top as a signal to any nearby passing boats
which could rescue them. He climbed most of the day and then decided to find a place to take
shelter for the night. In the distance, he noticed a rather deep cave. It was night so he decided
to wait for the day to come as it would be too dangerous going in cave without any light. With the
sun rise he approached; inside the cave, he saw a strange thing that looked like a chair with
something next to him that ... didn't know what it was. He sat down on the chair and out of
curiosity pulled the lever that would completely change his life.""", 500, 200)
canvasChoiceButton("All of a sudden...",holograph ,700, 400)
def saveBrother():
textToCanvas("""He barely saved his brother, but they couldn’t celebrate yet as they both got injured.
As they swept away by the shores of another island.
They saw huge mountain in the middle. He had never seen anything like it before and thought of climbing
to the top so they can try to set fire on top as a signal to any nearby passing boats which could
rescue them. He climbed most of the day and then decided to find a place to take shelter for the
night. In the distance, he noticed a rather deep cave. It was night so he decided to wait for the
day to come as it would be too dangerous going in cave without any light. With the sun rise he
approached; inside the cave, he saw a strange thing that looked like a chair with something next
to him that ... didn't know what it was. He sat down on the chair and out of curiosity pulled the
ever that would completely change his life.""", 500, 200)
canvasChoiceButton("All of a sudden...",holograph , 700, 400)
def setSail():
textToCanvas("""He ordered the workers of the island to build in a working week a boat that could carry
at most four people and some supplies for the trip. After the boat was finished, they started the
journey of their lifetime which they expected to be the best one. In the middle of the ocean,
when it was getting dark, a storm was coming towards them.
Eventually, the storm appeared over them and the boat was collapsing due to strong waves of the ocean.
At that moment he could see his brothers struggling but he felt helpless. He had a difficult choice to
make between staying where he was and keep holding on to safety OR risk his life to save his brother.
Do you choose Safety or Brother?""", 500, 200)
canvasChoiceButton("Save brother", saveBrother, 700, 400)
canvasChoiceButton("Get to safety", getToSafety, 800, 400)
def talkWithWife():
textToCanvas("""He took his time, thought about it and one day he finally decided
to go and talk with his wife.
'Ana, I know you don't like me leaving and going on adventures but I gave a lot of thought into it and I
know I am able to do this and bring something home that would make you proud. I´ll be leaving next week and my
brothers. Will you come with me...'
'I don't know what do you expect to discover Ricardo, I hope you're sure about this...'
'I believe that there is something on this planet that no one found yet and with this journey I would be able to go
down in history over the years. Please trust me Ana!'
'Ok, my dear, take care of you and your brothers and may God be with you.'""", 500, 200)
canvasChoiceButton("After the talk...", setSail, 700, 400)
def choseNorth():
textToCanvas("""You've chosen North.
North wasn´t the easiest path for him but it wasn't impossible either.
He was sure he would face difficulties and his brothers would have to deal with a
lot more difficulties. It would be more adventurous and challenging.""", 500, 200)
canvasChoiceButton("Continue", talkWithWife, 700, 400)
def choseSouth():
textToCanvas("""South was a bit easier but it had some difficulties coming with it as well.
It wasn´t going to be as simple as living his normal day to day life but some stories he had heard
and maps made by previous attempts would help him a lot having a safer trip.""", 500, 200)
canvasChoiceButton("Continue", talkWithWife, 700, 400)
def canvasChoiceButton(buttonText, command, w, h):
choice = Button(text=buttonText, command=command)
window.create_window(w, h, window=choice)
def start():
name = userName.get()
string = "Hello " + name + """, I hope you enjoy our story, The Mighty Time Machine!
In the seventh century, in a distant place from popular civilization there was a man named Ricardo.
He was the leader of a small island that was surrounded by others in a big ocean basin.
Having the same routines day after day he was getting tired of it so he decided to challenge himself and
leave the island to make a new discovery. Something new that nobody had discovered before.
He had two directions to go to. It was a decision between NORTH and SOUTH.
Do you choose North or South?"""
textToCanvas(string, 500, 200)
canvasChoiceButton("North", choseNorth, 200, 500)
canvasChoiceButton("South", choseSouth, 300, 500)
userName = Entry(master)
window.create_text(250, 120, text="What's your name?")
window.create_window(250, 140, window=userName)
enter = Button(text="Enter", command=start)
window.create_window(250, 170, window=enter)
master.mainloop()