[ create a new paste ] login | about

Link: http://codepad.org/hQiFhHSZ    [ raw code | output | fork ]

Python, pasted on Mar 26:
print("Hello")

import random
import tkinter

def sayMyName():
    numberInput = enterName.get()
    thisLabel.config(text="Hello " +numberInput)

def randrange():
    answer = random.randrange(1,9)
    print(answer)


window = tkinter.Tk()

window.title("Magic 8 Ball Program")
window.geometry("400x400")

thisLabel = tkinter.Label(text="Magic")
thisLabel.pack()

enterName = tkinter.Entry(window)
enterName.pack()

thisButton = tkinter.Button(text="Name",command=sayMyName)
thisButton.pack()

button = tkinter.Button(text="Number",command=randrange)
button.pack()

pic8ball = tkinter.PhotoImage(file="magicBallStart.png")
runButton = tkinter.Button(frame, image-pic8ball, text-"")

window.mainloop() 


Output:
1
2
3
4
5
Hello
Traceback (most recent call last):
  Line 4, in <module>
    import tkinter
ImportError: No module named tkinter


Create a new paste based on this one


Comments: