0 Replies - 470 Views - Last Post: 29 October 2012 - 04:55 AM Rate Topic: -----

#1 chatman16   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 29-October 12

Scroll bar problem python 3.3

Posted 29 October 2012 - 04:55 AM

Hi i am trying to make a scroll bar work in a dating program for a programming class, no one can get the scroll bar to work.

Here is my code.



import tkinter
messagebox = tkinter.messagebox
# functions
def man():
messagebox.showinfo("","Sorry im not into men, i like girls... ")

def smoker():
messagebox.showwarning("", "Sorry i do not date people who smoke! ")

def relationship():
messagebox.showinfo("","Sorry i dont go out with people who are in relationships! ")

def notgamer():
messagebox.showinfo("", "Sorry im too nerdy for girls who are'nt gamers! ")

def nosammichmaker():
messagebox.showinfo("","Sorry i only date girls who can make me sammiches. ")

def pothead():
messagebox.showinfo("","No thanks druggie! ")

def hatescake():
messagebox.showinfo("","You dont like cake?? I apologise i dont think this could work. ")

def nomovie():
messagebox.showinfo("","Sorry i dont see how this could work, i watch alot of movies. ")

def notout():
messagebox.showinfo("","I am a very active person i dont see this being able to work. ")

def onetofour():
messagebox.showinfo("","Sorry im too shallow for you. ")
def ninetoten():
messagebox.showinfo("","Come on over you won yourself a date! ")

def nonerdy():
messagebox.showinfo("","Sorry im a nerd... ")

def towny():
messagebox.showinfo("","Sorry you live too far away. ")

def clarenvilleperson():
messagebox.showinfo("","Sorry i dont date people from clarenville. ")

def date():
messagebox.showinfo("","If you have completed all of these questions correctly you have won a date! Step up and claim your prize! ")


# where the widgets are


mainwindow = tkinter.Tk()
Text =tkinter.Text(mainwindow, width=50, height=20)
scrollbar = tkinter.Scrollbar(mainwindow, borderwidth = 2)
scrollbar.config(command=Text.yview)
Text.config(yscrollcommand=scrollbar.set)
scrollbar.grid(row=20,column=30)
title = tkinter.Label(mainwindow, text = "The Dating Game", font = "timesnewroman 40")
question2 = tkinter.Label(mainwindow, text = "2) Are you a smoker? ")
smokeryescheckbox = tkinter.Checkbutton(mainwindow, text = "Yes", command = smoker)
smokernocheckbox = tkinter.Checkbutton(mainwindow, text = "No")
question1 = tkinter.Label(mainwindow,text = "1) Are you Male or Female? ")
malebox= tkinter.Checkbutton(mainwindow, text= "Male", command = man)
femalebox= tkinter.Checkbutton(mainwindow, text= "Female")
question3 = tkinter.Label(mainwindow, text = "3) Are you in a relationship? ")
relyes = tkinter.Checkbutton(mainwindow, text = "Yes", command = relationship)
relno = tkinter.Checkbutton(mainwindow, text = "No")
question4 = tkinter.Label(mainwindow, text = "4) Do you enjoy playing videogames? ")
gameryes = tkinter.Checkbutton(mainwindow, text = "Yes")
gamerno = tkinter.Checkbutton(mainwindow, text = "No")
question5 = tkinter.Label(mainwindow, text = "5) do you enjoy making sammiches?")
sammichyes = tkinter.Checkbutton(mainwindow, text = "Yes")
sammichno = tkinter.Checkbutton(mainwindow, text = "No", command = nosammichmaker)
question6 = tkinter.Label(mainwindow, text = "6) Do you do drugs? ")
drugyes = tkinter.Checkbutton(mainwindow, text = "Hell yeah!", command = pothead)
drugno = tkinter.Checkbutton(mainwindow, text = "No")
question7 = tkinter.Label(mainwindow, text = "7) Do you like cake? ")
cakeyes = tkinter.Checkbutton(mainwindow, text = "Yes")
cakeno = tkinter.Checkbutton(mainwindow, text = "No", command = hatescake)
question8 = tkinter.Label(mainwindow, text = "8) Do you enjoy watching movies? ")
movieyes = tkinter.Checkbutton(mainwindow, text = "Yes")
movieno = tkinter.Checkbutton(mainwindow, text = "No", command = nomovie)
question9 = tkinter.Label(mainwindow, text = "9) Do you consider yourself an outgoing person? ")
outyes = tkinter.Checkbutton(mainwindow, text = "Yes")
outno = tkinter.Checkbutton(mainwindow, text = "No", command = notout)
question10 = tkinter.Label(mainwindow, text = "10) what do you rate yourself on a scale of 1 to 10? ")
hotno = tkinter.Checkbutton(mainwindow, text = "1-4", command = onetofour)
hotyes = tkinter.Checkbutton(mainwindow, text = "5-8")
hothellyes= tkinter.Checkbutton(mainwindow, text = "9-10", command = ninetoten)
question11 = tkinter.Label(mainwindow, text = "11) Do you like nerdy people? ")
nerdyes = tkinter.Checkbutton(mainwindow, text = "Yes")
nerdno = tkinter.Checkbutton(mainwindow, text = "No", command = nonerdy)
question12 = tkinter.Label(mainwindow, text = "12) Where do you live? ")
bay = tkinter.Checkbutton(mainwindow, text = "Around the bay", command = date)
town = tkinter.Checkbutton(mainwindow, text = "Town", command = towny )
clarenville = tkinter.Checkbutton(mainwindow, text = "Clarenville", command = clarenvilleperson )




# packing place
scrollbar.pack( side = "right", fill= "y")
title.pack(anchor = "n")
# Question 1
question1.pack(anchor = "w")
malebox.pack(anchor= "w")
femalebox.pack(anchor = "w")
# Question 2
question2.pack(anchor= "w")
smokeryescheckbox.pack(anchor = "w")
smokernocheckbox.pack(anchor = "w")
# Question 3
question3.pack(anchor = "w")
relyes.pack(anchor= "w")
relno.pack(anchor="w")
# Question 4
question4.pack(anchor = "w")
gameryes.pack(anchor= "w")
gamerno.pack(anchor="w")
# Question 5
question5.pack(anchor="w")
sammichyes.pack(anchor= "w")
sammichno.pack(anchor="w")
# Question 6
question6.pack(anchor="w")
drugyes.pack(anchor= "w")
drugno.pack(anchor="w")
# Question 7
question7.pack(anchor="w")
cakeyes.pack(anchor= "w")
cakeno.pack(anchor="w")
# Question 8
question8.pack(anchor="w")
movieyes.pack(anchor= "w")
movieno.pack(anchor="w")
# Question 9
question9.pack(anchor="w")
outyes.pack(anchor= "w")
outno.pack(anchor="w")
# Question 10
question10.pack(anchor="w")
hotno.pack(anchor= "w")
hotyes.pack(anchor="w")
hothellyes.pack(anchor="w")
# Question 11
question11.pack(anchor="w")
nerdyes.pack(anchor= "w")
nerdno.pack(anchor="w")
# Question 12
question12.pack(anchor="w")
bay.pack(anchor= "w")
clarenville.pack(anchor="w")
town.pack(anchor="w")





# This is where the window loops
mainwindow.mainloop()

Is This A Good Question/Topic? 0
  • +

Page 1 of 1