Example #1
0
def main():
    # set up logging
    logging.basicConfig(level=logging.WARNING)
    log.info("")
    log.info("")
    log.info("Paperdoll editor")
    log.info("")
    log.info("cwd %s", os.getcwd())
    # initialize signalling
    sisi.add_signals("doll drawn", "draw doll", "export doll", "set state",
                     "set style", "state changed", "update dial state")
    sisi.add_channels("editor")
    # create editor model
    model.editor = model.MPaperdollEditor()
    # create Qt GUI
    view.version = __version__
    view.app = view.Application(sys.argv)
    view.gui = view.VEditorWindow(model.editor)
    # display the gui
    log.info("Show main window")
    view.gui.resizeToScreen(width=0.8, height=0.8)
    view.gui.centerOnScreen()
    view.gui.show()
    # define initial state and draw the doll
    for dial in model.editor.dials.values():
        dial.change_value(dial.value + 1)
        dial.change_value(dial.value - 1)
    sisi.send(signal="draw doll")
    #    print_state()
    # show GUI with Qt
    sys.exit(view.app.exec_())
 def __init__(self):
     self.root = tkinter.Tk()
     self.root.title("Tetris")
     self.model = model.GameModel()
     self.view = view.Application(self.root, self.model)
     self.viewflag = 1
     self.input = False
     self.state = "NULL"
Example #3
0
import view

app = view.Application()
app.master.title('AH Update Deployer')
app.mainloop()
Example #4
0
				of the camera that is being surrounded by a green box and thus being included in the final bounding
				box of the maze (in turn messing up the finding of the maze), raise the value of this slider until that
				small box is ignored.
		3c.) Erosion Level slider controls how much of the path is eroded away before trying to solve the maze. For mazes 
				with thick white paths, set this to a high value. For mazes with a skinny white path, set this to a low value.

RULES:
	1.) Maze should be completely within the field of view of the camera
	2.) Maze must be rectangular in shape
	3.) Maze must have EXACTLY 2 entry points (an entrance/start and an exit/end)
		3a.) Entry points do not need to be labeled in any way. They just need to exist
	4.) Travelable path must be a light color and walls must be a dark color	
	
"""

from Tkinter import *
import mazeSearch
import util
import argparse
import imaging
import view
import cam

vc = cam.VideoCamera()
root = Tk()
root.title("Maze Solver")
app = view.Application(vc, master=root)
root.after(0, app.loop)
app.mainloop()
vc.__del__()
    def start(self):

        self.setstate("IDLE")

        while True:

            button = self.getbuttoninput()
            if self.state != button:
                self.setstate(button)
                if button == "PLAY":
                    timer = time.time()
                if button == ("IDLE"):
                    self.model.__init__()
                    self.view.__init__(self.root, self.model)

            elif self.state == "PLAY":
                timepass = float(time.time() - timer)

                if timepass > (0.5):  #掉落計時器

                    if self.model.Fall_Down():
                        timer = time.time()
                        self.view.updateGame()
                    else:
                        self.setstate("OVER")
                        self.view.state = "IDLE"

                else:
                    key = self.getkeyinput()
                    if key != "":
                        print(key)
                        if key == "UP":
                            self.model.Turn()
                        elif key == "DOWN":
                            if not self.model.Fall_Down():
                                self.setstate("OVER")

                        elif key == "LEFT":
                            self.model.Move(-1)
                        elif key == "RIGHT":
                            self.model.Move(1)
                        self.view.clear_key()
                    self.view.updateGame()

            elif self.state == "SET":  #更改使用viewclass
                if self.viewflag != self.view.viewflag:
                    print("nowchange" + str(self.viewflag))
                    if self.view.viewflag == 1:
                        self.view.clear()
                        self.view = view.Application(self.root, self.model)
                        self.viewflag = 1
                        print("viewflag" + str(self.viewflag))
                    elif self.view.viewflag == 2:
                        self.view.clear()
                        self.view = view.View2(self.root, self.model)
                        self.viewflag = 2
                        print("viewflag" + str(self.viewflag))
                    elif self.view.viewflag == 3:
                        self.view.clear()
                        self.view = view.View_HU(self.root, self.model)
                        self.viewflag = 3
                        print("viewflag" + str(self.viewflag))
                    elif self.view.viewflag == 4:
                        self.view.clear()
                        self.view = view.View4(self.root, self.model)
                        self.viewflag = 4
                        print("viewflag" + str(self.viewflag))

            self.root.update()