If u run this code then click on the button helicase, u'd notice that there is a space btw radiobutton 1 and the rest! why? how can i fix this?

I am sorry i know my code is too long but i don't know which section of it was causing that error...maybe someone can just tell what might cause a problem like mine in general..?

import ImageTk
import tkMessageBox
from Tkinter import*
from turtle import *
import time

root = Tk()#main window
root.title("Replicate DNA yourself!")#title of my main window

global position
position = IntVar()#choice of position of enzyme-RadioButtons
global info
info = StringVar()#string of instructions dispalyed to the user in the label in the frame at the bottom of the window
info.set("choose enzyme^")
global step
step = 1# a count for the step of DNA replication we are in
global answ
answ=StringVar()#a variable to store users answers to some popup questions
global statement
statement=StringVar()#a variable that holds the text in a label in popups
global advice
advice=StringVar()#a variable to hold the hint for the different steps

window = Canvas(root, width=800, height=480, bg="white")#canvas named window
window.grid(column=1, rowspan=6, row=0, columnspan=5)

frame = Frame(root, bg="purple", relief="sunken", height=200, width=800, bd=5, padx=10, pady=5)#frame at the bottom of the window
frame.grid(column=1, columnspan=3, row=6, rowspan=2)
frame.columnconfigure(0, weight=1)
frame.columnconfigure(1, weight=1)
frame.columnconfigure(2, weight=1)
frame.rowconfigure(0, weight=1)
frame.rowconfigure(1, weight=1)
frame.grid_propagate(False)#so that the frame does not shrink to the size of its contents
label = Label(frame, bg="green", fg="white", anchor="center", textvariable=info, justify="center",font=("Helvetica", 23))#label in frame
label.grid(in_=frame, row=0, rowspan=1, column=1,columnspan=1, sticky="n")
title=Label(root,text="Replicate DNA yourself!",bg="white",font=("Helvetica", 23))
title.grid(column=2,row=0)


def hint():
    Help=Toplevel(root,bg="black")
    Help.overrideredirect(True)
    Help.geometry('705x350+251+180')
    Help.columnconfigure(0, weight=5)
    Help.columnconfigure(1, weight=1)
    Help.rowconfigure(0, weight=1)
    Help.rowconfigure(1, weight=1)

    Advice=Label(Help,bg="black",fg="white",textvariable=advice,justify="left",font=("Comic Sans Ms", 11)).grid(row=0,column=0)
    if step==1:
        advice.set("helicase,ishdfuhsdofhasi\nuhf oisdhfashdoif;juadsofjndsahvao;idjfadsngv\nouiahdgandfgipaeuhrgiuaeritunv;asdoghuierhgaednbfiaushd\nfg;oashdfiaushfdiuashbdfjkbasdiufhasdgb\nfviudfhg;asdnfv;jkadshbgoiuajer\ngvnfda;uighao;isdhgfa;jkdsbfg;i\nuadsnvj;knadfiughaer;gn;akjdnhg;aj\nhgf;adsnhg;aijhrg;andsfv;kjandgijhadf\ngnha;skdfhj;asdhgka;djfng;akidjhgaodshf;kajsdnf;aikdjhfadsbhg\n;kasdjf;liasdhg;dsnhcvjdo;ighfadsgha;lksdfj;adsgh")
    elif step==2:
        advice.set("gyrase")
    elif step==3:
        advice.set("ssb")
    elif step==4 or step==5:
        advice.set("primase")
    elif step==6:
        advice.set("Pol3")
    elif step==7:
        advice.set("Pol1")
    else:
        advice.set("We are done")
    okay=Button(Help,bg="yellow",fg="black",text="ok",font=("Times", 10,"bold"),width=5,command=Help.destroy)
    okay.grid(row=1,column=2)

Hint=Button(root,bg="blue",text="Give me a hint",font=("Times", 10,"bold"),fg="white",height=3,command=hint)
Hint.grid(row=6,column=0)


########################################################################################################################################################
def generalradio():
    global step
    step+=1
    info.set('choose next enzyme')
    global bh1,bh2,bh3,bh4,bh5
    bh1.grid_remove()
    bh2.grid_remove()
    bh3.grid_remove()
    bh4.grid_remove()
    bh5.grid_remove()

def radioh():
    global position
    if position.get()==1:
        window.delete(ALL)
        window.create_image(400,300,image=after_helicase)
        generalradio()
    else:
        info.set('wrong position')

def radiog():
    global position
    if position.get()==2:
        window.delete(ALL)
        window.create_image(400,300,image=after_gyrase)
        generalradio()
    else:
        info.set('wrong position')

def radios():
    global position
    if position.get()==3:
        window.delete(ALL)
        window.create_image(400,300,image=after_ssb)
        generalradio()
    else:
        info.set('wrong position')

def radiop11():
    window.delete(ALL)     
    window.create_image(400,300,image=after_prymase1b)
    generalradio()

def radiop1():
    global position
    if position.get()==4:
        window.create_image(400,300,image=after_prymase1a)
        window.after (1000,func=radiop11)
    else:
        info.set('wrong position')
def radiop222():
    window.delete(ALL)
    window.create_image(400,300,image=after_prymase2c)
    generalradio()

def radiop22():
    window.delete(ALL)
    window.create_image(400,300,image=after_prymase2b)
    window.after (1000,func=radiop222)

def radiop2():
    global position
    if position.get()==4:
        window.create_image(400,300,image=after_prymase2a)
        window.after (1000,func=radiop22)
    else:
        info.set('wrong position')

def radio3dd():
    window.delete(ALL)
    window.create_image(400,300,image=after_pol3e)
    generalradio()

def radio3d():
    global position
    if position.get()==2:
        window.delete(ALL)
        window.create_image(400,300,image=after_pol3d)
        window.after (1000,func=radio3dd)
    else: info.set('try again!')

def radio3cc():
    window.delete(ALL)
    window.create_image(400,300,image=choose_pol3d)
    global lsst
    for button in lsst:
        button.configure(command=radio3d)

def radio3c():
    global position
    if position.get()==1:
        window.delete(ALL)
        window.create_image(400,300,image=after_pol3c)
        window.after (1000,func=radio3cc)
    else: info.set("try again!")

def radio3bb():
    window.delete(ALL)
    window.create_image(400,300,image=choose_pol3c)
    global lsst
    for button in lsst:
        button.configure(command=radio3c)

def radio3b():
    global position
    if position.get()==5:
        window.delete(ALL)
        window.create_image(400,300,image=after_pol3b)
        window.after (1000,func=radio3bb)
    else:info.set("try again!")

def radio3aa():
    window.delete(ALL)
    window.create_image(400,300,image=choose_pol3b)
    global lsst
    for button in lsst:
        button.configure(command=radio3b)

def radio3a():
    global position
    if position.get()==3:
        window.delete(ALL)
        window.create_image(400,300,image=after_pol3a)
        window.after (1000,func=radio3aa)
    else:
        info.set('wrong position')

def radio11():
    window.create_image(400,300,image=after_pol1b)
    generalradio()
    print step
    info.set("We Are Done =D \n dsDNA has been polymerized \nusing semiconservative replication\n well done")


def radio1():
    global position
    if position.get()==10:
        window.create_image(400,300,image=after_pol1a)
        window.after (1000,func=radio11)
    else:
        info.set('wrong position')


################################################# FUNCTIONS CALLED WHEN BUTTON IS PRESSED ############################################################
def generalenz():
    info.set("where should it be placed?")
    global bh1, bh2,bh3,bh4, bh5
    bh1.grid(in_=frame,row=1,column=1)
    bh2.grid(in_=frame,row=2,column=1)
    bh3.grid(in_=frame,row=3,column=1)
    bh4.grid(in_=frame,row=4,column=1)
    bh5.grid(in_=frame,row=5,column=1)
    bh6.select()
    bh1.deselect()
    bh2.deselect()
    bh3.deselect()
    bh4.deselect()
    bh5.deselect()



def fhelicase():
    global step
    if step==1:
        window.delete(ALL)
        window.create_image(400,300,image=choose_helicase)
        generalenz()
        global lsst
        for button in lsst:
            button.configure(command=radioh)    
    else:
        global info
        info.set("try again")

def fgyrase():
    if step==2:
        window.delete(ALL)
        window.create_image(400,300,image=choose_gyrase)
        generalenz()
        global lsst
        for button in lsst:
            button.configure(command=radiog) 
    else:
        info.set("try again")

def fssb():
    if step==3:
        window.delete(ALL)
        window.create_image(400,300,image=choose_ssb)
        generalenz()
        global lsst
        for button in lsst:
            button.configure(command=radios) 
    else:
        info.set("try again")
def clickOk():
    global quest
    quest.destroy()
    window.create_image(400,300,image=choose_prymase1)
    generalenz()
    global lsst
    for button in lsst:
        button.configure(command=radiop1)

def fquest():
    global statement
    if answ.get()=='low':
        statement.set("That's wrong =( \n  The upper strand is the leading strand as polymerization is continuous.")
    else:
        statement.set("That's true, well done :) \nLet's start by polymerizing it first as it undergoes continuous replication.")
    global quest,bup,blow
    bup.grid_remove()
    blow.grid_remove()
    ok=Button(quest,bg="yellow", text="OK",activebackground="orange", command=clickOk).grid(row=3,column=3)

def fprimase():
    if step==4:
        window.delete(ALL)
        global quest,answ,bup,blow
        quest=Toplevel(root,bg="yellow")
        quest.overrideredirect(True)
        quest.geometry('475x80+350+300')
        poptxt=Label(quest,bg="yellow",textvariable=statement,justify="center",font=("Times",11,"bold")).grid(row=0,column=3)
        statement.set(" Which is the leading strand in this case? The upper or the lower?")
        bup=Radiobutton(quest,bg="yellow",text="upper strand",font=("Times",12),activebackground="yellow",variable=answ,value='up',command=fquest)
        bup.grid(row=1,column=3)
        blow=Radiobutton(quest,bg="yellow",text="lower strand",font=("Times",12),activebackground="yellow",variable=answ,value='low',command=fquest)
        blow.grid(row=2,column=3)
        bNo=Radiobutton(quest,bg="yellow",text="no strand",font=("Times",12),activebackground="yellow",variable=answ,value='none',command=fquest)
        bup.deselect()
        blow.deselect()
        bNo.select()
    elif step==5:
        window.delete(ALL)
        tkMessageBox.showinfo("","Now that the leading strand is all ready to be polymerized,\n it's the lagging strand's turn to get ready!")
        window.create_image(400,300,image=choose_prymase2)
        generalenz()
        global lsst
        for button in lsst:
            button.configure(command=radiop2)
    else:
        info.set("try again")


def fpol3():
    if step==6:
        window.delete(ALL)
        window.create_image(400,300,image=choose_pol3a)
        generalenz()
        global lsst
        for button in lsst:
            button.configure(command=radio3a) 
    else:
        info.set("try again")

def fpol1():
    if step==7:
        window.delete(ALL)
        window.create_image(400,300,image=choose_pol1)
        bh1.configure(text="2,6,7,4",value=1)
        bh2.configure(text="4,1,5,3",value=10)
        bh3.configure(text="2,1,6,5",value=1)
        bh4.configure(text="7,3,5,4",value=1)
        bh5.configure(text="1,4,2,6",value=1)
        generalenz()
        global lsst
        for button in lsst:
            button.configure(command=radio1) 
    else:
        info.set("try again")


#################################### BUTTONS #################################

pol3=ImageTk.PhotoImage(file="pol3.gif")
Pol3=Button(root,height=72,width=89,text="DNA Polymerase III",image=pol3,compound="top",bg="white",command=fpol3)
Pol3.image=pol3
Pol3.grid(row=0)

gyrase=ImageTk.PhotoImage(file="gyrase.gif")
Gyrase=Button(root,text="gyrase",height=72,width=89,image=gyrase,compound="top",bg="white",command=fgyrase)
Gyrase.image=gyrase
Gyrase.grid(row=1)

ssb=ImageTk.PhotoImage(file="ssbb.gif")
Ssb=Button(root,text="ssb",height=72,width=89,image=ssb,compound="top",bg="white",command=fssb)
Ssb.image=ssb
Ssb.grid(row=2)

primase=ImageTk.PhotoImage(file="primase.gif")
Primase=Button(root,text="primase",height=72,width=89,image=primase,compound="top",bg="white",command=fprimase)
Primase.image=primase
Primase.grid(row=3)

helicase=ImageTk.PhotoImage(file="helicase.gif")
Helicase=Button(root,text="Helicase",height=72,width=89,image=helicase,compound="top",bg="white",command=fhelicase)
Helicase.image=helicase
Helicase.grid(row=4)

pol1=ImageTk.PhotoImage(file="pol1.gif")
Pol1=Button(root,text="DNA PolymeraseI",height=72,width=89,image=pol1,compound="top",bg="white",command=fpol1)
Pol1.image=pol1
Pol1.grid(row=5)

##############################################################################
global bh1
global bh2
global bh3
global bh4
global bh5
global bh6
bh1=Radiobutton(frame,text='1',variable=position,value=1,bg="blue")
bh2=Radiobutton(frame,text='2',variable=position,value=2,bg="blue")
bh3=Radiobutton(frame,text='3',variable=position,value=3,bg="blue")
bh4=Radiobutton(frame,text='4',variable=position,value=4,bg="blue")
bh5=Radiobutton(frame,text='5',variable=position,value=5,bg="blue")
bh6=Radiobutton(frame,text='6',variable=position,value=6,bg="blue")
global lsst
lsst=[bh1,bh2,bh3,bh4,bh5,bh6]



start=ImageTk.PhotoImage(file="start.gif")
choose_helicase=ImageTk.PhotoImage(file="choose_helicase.gif")
after_helicase=ImageTk.PhotoImage(file="after_helicase.gif")
choose_gyrase=ImageTk.PhotoImage(file="choose_gyrase.gif")
after_gyrase=ImageTk.PhotoImage(file="after_gyrase.gif")
choose_ssb=ImageTk.PhotoImage(file="choose_ssb.gif")
after_ssb=ImageTk.PhotoImage(file="after_ssb.gif")
choose_prymase1=ImageTk.PhotoImage(file="choose_prymase1.gif")
after_prymase1a=ImageTk.PhotoImage(file="after_prymase1a.gif")
after_prymase1b=ImageTk.PhotoImage(file="after_prymase1b.gif")
choose_prymase2=ImageTk.PhotoImage(file="choose_prymase2.gif")
after_prymase2a=ImageTk.PhotoImage(file="after_prymase2a.gif")
after_prymase2b=ImageTk.PhotoImage(file="after_prymase2b.gif")
after_prymase2c=ImageTk.PhotoImage(file="after_prymase2c.gif")
choose_pol3a=ImageTk.PhotoImage(file="choose_pol3a.gif")
choose_pol3b=ImageTk.PhotoImage(file="choose_pol3b.gif")
choose_pol3c=ImageTk.PhotoImage(file="choose_pol3c.gif")
choose_pol3d=ImageTk.PhotoImage(file="choose_pol3d.gif")
after_pol3a=ImageTk.PhotoImage(file="after_pol3a.gif")
after_pol3b=ImageTk.PhotoImage(file="after_pol3b.gif")
after_pol3c=ImageTk.PhotoImage(file="after_pol3c.gif")
after_pol3d=ImageTk.PhotoImage(file="after_pol3d.gif")
after_pol3e=ImageTk.PhotoImage(file="after_pol3e.gif")
choose_pol1=ImageTk.PhotoImage(file="choose_pol1.gif")
after_pol1a=ImageTk.PhotoImage(file="after_pol1a.gif")
after_pol1b=ImageTk.PhotoImage(file="after_pol1b.gif")

window.create_image(400,300,image=start)
window.mainloop()

Can you attach a zip with the gif images, so that we can run the code ?

never mind ;) i've solved it!
I just had to change the rowspan of frame from 2 to 1
and delete frame.rowconfigure(1, weight=1)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.