Jun-13-2018, 05:18 PM
Ok so I tried that but it wont go into landscape() now
from graphics import* from pygame import* import pygame import graphics ##Variables## x,y=0,0 #positions of mouse clicks p1 = GraphWin("coord locator",1440,900) Morange=False Mpurple=False if Mpurple==True: Landscape() if Morange==True: Landscape() ##Main## p1.setBackground('blue') txt = Text(Point(725,125),'Select Your class') txt.setTextColor('red') txt.setSize(16) txt.setFace('times roman') txt.draw(p1) txt1 = Text(Point(690,200),'Mounted Knight\t\t\t\t\t Knight') txt1.setTextColor('red') txt1.setSize(16) txt1.setFace('times roman') txt1.draw(p1) class1=Image(Point(450,400),'Mknightlogo.gif') class1.draw(p1) class2=Image(Point(975,400),'Knightlogo.gif') class2.draw(p1) Mknighto=Image(Point(200,600),'Mknighto.gif') Eknight=Image(Point(1200,700),'Eknight.gif') Mknightp=Image(Point(200,600),'Mknightp.gif') ##Functions## def Landscape(): grass = Rectangle(Point(0,765),Point(1450,900)) grass.setFill('green') grass.draw(p1) sky = Rectangle(Point(0,765),Point(1450,0)) sky.setFill('sky blue') sky.draw(p1) sun=Image(Point(1200,200),'sun.gif') Eknight.draw(p1) while True: if Morange == True: Mknighto.draw(p1) print ('this is working sort of') if Mpurple == True: Mknightp.draw(p1) print ('this is working sort of') def mknighto(): global Morange Morange = True return def mknightp(): global Mpurple Mpurple = True return def Mknight(): p1.setBackground('green') txt.setText('You haven choosen your trusty study, choose your Colour') txt.draw(p1) txt1.setText('Orange\t\t\t\t\t Purple') txt1.draw(p1) txt1.move(40,0) clr=Image(Point(490,450),'orangecl.gif') clr.draw(p1) clr1=Image(Point(975,450),'purplecl.gif') clr1.draw(p1) while True: p=p1.checkMouse() if p: x=p.getX() y=p.getY() print(x,y) if 290<x<690 and 250<y<650 : txt.undraw() txt1.undraw() clr1.undraw() clr.undraw() mknighto() break if 775<x<1175 and 250<y<650 : txt.undraw() txt1.undraw() clr1.undraw() clr.undraw() mknighto() break