Exemplo n.º 1
0
def main():

    root = tk.Tk()
    app = gui.App(master=root)
    root.title("playerEstimation")
    root.geometry("580x580")

    app.mainloop()
    root.destroy()
Exemplo n.º 2
0
def main():
    global graphVar, exit, guiVar, predictioncondition

    #setpriority(5)

    threadHK = threading.Thread(target=housekeeper, args=())
    threadHK.setDaemon(True)
    threadHK.start()
    threadKeys = threading.Thread(target=keys, args=())
    #threadKeys.setDaemon(True)
    threadKeys.start()

    print("Setup finished, starting threads")

    if len(sys.argv) > 1:
        if sys.argv[1] == "gui":
            app = ttk.App()
        elif sys.argv[1] == "drone":
            killkeys = True
            threadDataCatcher = threading.Thread(target=dataCatcher, args=())
            threadDataCatcher.setDaemon(True)
            threadDataCatcher.start()
            predictioncondition = True
            housekeepThread = threading.Thread(target=controller.housekeeper,
                                               args=())
            housekeepThread.start()
            #controller.droneController()
            controller.originalDroneController()
            os._exit(0)

    #threadDataCatcher = threading.Thread(target=dataCatcher,args=())
    #threadDataCatcher.setDaemon(True)
    #threadDataCatcher.start()
    #threadGui = threading.Thread(target=ttk.guiloop, args=())
    #threadGui.setDaemon(True)
    #threadGui.start()
    #ttk.guiloop()
    #thread2 = threading.Thread(target=QtGui.QApplication.instance().exec_(),args=())

    #thread2.start()

    #thread0.join()
    #thread1.join()
    #thread2.join()

    #while not graphVar:
    #tme.sleep(0.1)
    '''	
	while not guiVar:
		tme.sleep(0.1)
	if not exit:
		#graph()	
		#ttk.guiloop()
		app = ttk.App()
	'''
    while not exit:
        tme.sleep(1)
Exemplo n.º 3
0
def main():
    '''
    Excutes full program. Sets up all handlers and initailzes the gui
    '''
    time_string = datetime.now().strftime('%Y%m%d %H%M')

    # Get necessary file paths
    paths = init_paths()
    #    paths = {'instep':'C:/Users/Raman/Desktop/Instep_out', 'raw':'C:/Users/Raman/Desktop/Raman/Input'}

    raman_regex = r'.+\.txt'  # Raman file is any that ends in .txt

    # InStepAutosave is any that ends in InStepAutoSave.txt
    instep_regex = r'.+InStepAutoSave\.txt'

    # Create the raw spectrum handler
    raw_handler = classes.RawFileProcessor()

    # Create the plotter for the prediction handler, then create the prediction handler
    prediction_plotter = classes.Plotter()
    prediction_plotter.set_ylabel('Concentration (g/L)')
    prediction_handler = classes.PredictionHandler(prediction_plotter)

    # Create the plotter for the PID handler, then create the PID handler
    pid_plotter = classes.Plotter()
    pid_plotter.set_ylabel('Cumulative Vol. (mL)')

    # Here the log file of the PID handler is set to be in the same directory as
    # the InStep autosave file.
    # Other defaults are set, like the 200mL max volume, and that it's tracking index 0 of
    # the autosave file

    paths['log_file'] = paths[
        'instep'] + f'/pid_log_{time_string}.txt'  # Where to save PID output
    pid_handler = classes.PIDHandler(200, prediction_handler, pid_plotter, 0,
                                     paths['log_file'])

    # Create the plotting_dict and pass it to the App
    plot_dict = {'Raman Plot': prediction_plotter, 'PID Plot': pid_plotter}
    app = gui.App(plot_dict, pid_handler)

    # Get the current event loop
    loop = asyncio.get_event_loop()

    # Add the three async tasks defined above to event loop
    loop.create_task(run_tk(app, loop))
    loop.create_task(raw_watcher(paths['raw'], raman_regex, raw_handler))
    loop.create_task(
        instep_watcher(paths['instep'], instep_regex, prediction_handler,
                       pid_handler, app, paths['log_file']))

    # Run the loop forever
    loop.run_forever()
Exemplo n.º 4
0
def main():
    global APP
    APP = gui.App()
    APP.Update()
    TIMER = threading.Timer(1, Mouse_Fix)
    TIMER.start()
    hm = pyHook.HookManager()
    hm.KeyDown = onKeyboardEvent
    hm.HookKeyboard()
    hm.MouseAll = onMouseEvent
    hm.HookMouse()
    pythoncom.PumpMessages()
Exemplo n.º 5
0
def main(args):
    # Imports are here so we don't need to wait for them to load unecessarily.
    import os
    import tkinter

    from video import Video
    from annotation import Annotations
    from state import State
    import gui

    # Parameters
    video_file_path = args.video_file_path
    annotation_file_path = args.annotation_file_path

    if annotation_file_path is None:
        # Expect the following dir structure:
        # dataset/
        # - videos/
        # - annotations/
        split_path = os.path.split(video_file_path)
        annotation_file_name = split_path[-1].split('.')[0] + '.pkl'
        annotation_file_dir = list(split_path[:-1]) + ['..', 'annotations']
        annotation_file_dir = os.path.join(*annotation_file_dir)
        if not os.path.isdir(annotation_file_dir):
            print('Invalid directory structure.')
            return
        annotation_file_path = os.path.join(annotation_file_dir,
                                            annotation_file_name)

    # Load Video
    video = Video(video_file_path)
    annotations = Annotations(annotation_file_path, video)
    state = State(video, annotations)

    # Create GUI
    gui.App(tkinter.Tk(), state)

    # When everything done, release the video capture object
    video.close()
Exemplo n.º 6
0
#!/usr/bin/env python3

from tkinter import Tk
from twisted.internet import reactor, tksupport

import gui

if __name__ == '__main__':
    root = Tk()
    tksupport.install(root)
    gui.App(root)

    reactor.run()
Exemplo n.º 7
0
def main():
    root = gui.App()
Exemplo n.º 8
0
#     peer.build_peers(host, args.build_from, hops=10)
# if args.file_get:
#     file_name = args.file_get
#     peer.connect_and_send(host, args.peer_port, 'FGET', file_name)
# if args.query:
#     file_name = args.query
#     my_id = f'{host}:{port}'
#     ttl = '5'
#     data = ' '.join((my_id, file_name, ttl))
#     print('querying')
#     peer.connect_and_send(host, args.peer_port, 'QUER', data)
# if args.gui:
#     gui.main_loop(host=host, port=args.port)
# if args.run:
#     peer.main_loop()

if args.gui:

    build_from = None
    if args.build_from:
        build_from = RemotePeer(host=host, port=args.build_from)

    app = gui.App(host=host,
                  port=args.port,
                  build_from=build_from,
                  debug=args.debug)
    app.mainloop()

if args.run:
    peer.main_loop()
Exemplo n.º 9
0
import pygame
from pygame.locals import *
import gui

screen = pygame.display.set_mode(
    (640, 480), FULLSCREEN)  # try adding DOUBLEBUF | HWSURFACE
# pygame.mouse.set_visible(0)

app = gui.App()
c = gui.Container(width=640, height=480)

##
## dialog 1
##

t1 = gui.Table()
t1.tr()
t1.add(gui.Label("Gal Test"))

t2 = gui.Table()

t2.tr()
t2.add(gui.Label("Gui Widgets"))
t2.add(gui.Input())

t2.tr()
t2.add(gui.Label("Button"))
t2.add(gui.Button("Click Me!"))

d1 = gui.Dialog(t1, t2)
c.add(d1, 50, 150)
Exemplo n.º 10
0
def gui_connect():
    # handles the connection with the gui lib
    app = gui.QtWidgets.QApplication(gui.sys.argv)
    ex = gui.App()
    gui.sys.exit(app.exec())
Exemplo n.º 11
0

def analyze_chars(char_names):
    start_time = time.time()
    wx.CallAfter(app.PySpy.list.DeleteAllItems)
    try:
        outlist = analyze.main(char_names)
        duration = round(time.time() - start_time, 1)
        reportstats.ReportStats(outlist, duration).start()
        if outlist is not None:
            wx.CallAfter(app.PySpy.updateList, outlist, duration)
        else:
            statusmsg.push_status(
                "No valid character names found. Please try again...")
    except Exception:
        Logger.error("Failed to collect character information. Clipboard "
                     "content was: " + str(char_names),
                     exc_info=True)


app = gui.App(0)  # Has to be defined before background thread starts.

background_thread = threading.Thread(target=watch_clpbd, daemon=True)
background_thread.start()

update_checker = threading.Thread(target=chkversion.chk_github_update,
                                  daemon=True)
update_checker.start()

app.MainLoop()
Exemplo n.º 12
0
    if (d == "Amazon"):
        for x in os.listdir(os.path.join(main_path, "Data", "Accounts", d)):
            Amazon = parser.Amazon_Parser(
                os.path.join(main_path, "Data", "Accounts", d, x, ""), KEYS)
            all_accounts.append(Amazon)
            all_account_names.append(x)
    if (d == "DiBa"):
        for x in os.listdir(os.path.join(main_path, "Data", "Accounts", d)):
            DiBa = parser.DiBa_Parser(
                os.path.join(main_path, "Data", "Accounts", d, x, ""), KEYS)
            all_accounts.append(DiBa)
            all_account_names.append(x)
    if (d == "CA"):
        for x in os.listdir(os.path.join(main_path, "Data", "Accounts", d)):
            CA = parser.CA_Parser(
                os.path.join(main_path, "Data", "Accounts", d, x, ""), KEYS)
            all_accounts.append(CA)
            all_account_names.append(x)
    if (d == "LBB"):
        for x in os.listdir(os.path.join(main_path, "Data", "Accounts", d)):
            LBB = parser.LBB_Parser(
                os.path.join(main_path, "Data", "Accounts", d, x, ""), KEYS)
            all_accounts.append(LBB)
            all_account_names.append(x)
accounts = analyse.Balance(all_accounts, all_account_names, KEYS)
accounts.include_depot(depot)

app = gui.QApplication(sys.argv)
ex = gui.App(depot, accounts, KEYS, 3)
sys.exit(app.exec_())
Exemplo n.º 13
0
    # initialize smtp (email sending) and imap (email recieving) protocols
    receive = receive.Receive(username, password)
    send = send.Send(username, password)
    # send.send_message(username, "sadasd", "asdasdffasasfdsfa")

    msgs = []
    file_name = 'messages.data'
    # if msg file exists then read from it, else retreive msgs using imap
    if os.path.exists(file_name):
        msgs = gui.read_from_file(file_name)
    else:
        for label in labels:
            msgs.append(receive.get_message(category=label))

    # print inbox category only
    # for msg in msgs:
    #     print("To:\t", msg[1])
    #     print("Date:\t", msg[2])
    #     print("Subject:\t", msg[4])
    #     print("Content:\n", msg[5])
    #     print("_"*40)

    # load gui
    app = gui.QApplication(gui.sys.argv)
    ex = gui.App(mails_lst=msgs,
                 my_mail=username,
                 send=send,
                 receive=receive,
                 labels=labels)
    gui.sys.exit(app.exec_())
Exemplo n.º 14
0
import resources
import gui
import sys
from PyQt5.QtWidgets import QApplication

if __name__ == '__main__':
    nerd_konkurs = resources.Contest('NERD')
    nerd_konkurs.load_masters()
    nerd_konkurs.load_players()
    nerd_konkurs.populate_sessions()

    app = QApplication(sys.argv)
    ex = gui.App(nerd_konkurs)
    print('Goodbye World')
    sys.exit(app.exec_())
Exemplo n.º 15
0
#! /usr/bin/env python
#! coding:utf-8

import gui

if __name__ == "__main__":
    app = gui.App(False)
    app.MainLoop()
Exemplo n.º 16
0
                sys.exit(-1)
            except:
                print '>>> Unexpected exception:'
                traceback.print_exc()
                sys.exit(-3)

            if options.disassemble:
                if not options.quiet: print '--== Disasm ==--'
                print disassembler.disassemble(),

            if options.decompile:
                if not options.quiet: print '# --== Decompile ==--'
                print decompiler.decompile(),

            if options.gui:
                try:
                    import gui
                    gui.App(disassembler).start()
                except ImportError:
                    print '>>> Cannot load gui. Please make sure that you ' \
                          'have python-tk installed on your system.'
                    sys.exit(-2)
    else:
        if args:
            parser.error('incorrect number of arguments')
        if len(sys.argv) == 1:
            help(None, None, None, parser)

if __name__ == '__main__':
    start()
Exemplo n.º 17
0
import gui
import datasets as dt
import tkinter as tkr

if __name__ == "__main__":

    datasetDictionary = dt.DatasetsName()
    url = 'http://ec.europa.eu/eurostat/wdds/rest/data/v2.1/json/en/'
    root = tkr.Tk()
    root.geometry('1000x600')
    root.configure(bg='#509461')
    root.title('Eurostat Data')
    application = gui.App(root, datasetDictionary, url)

    root.mainloop()
    try:
        root.destroy()
    except tkr.TclError:
        pass
Exemplo n.º 18
0
 def setupGui(self):
     app = gui.App(game=self)
     app.mainloop()
Exemplo n.º 19
0
import sys
from PyQt5.QtWidgets import QApplication
from PyQt5 import QtWidgets

import gui


def catch_exceptions(t, val, tb):
    QtWidgets.QMessageBox.critical(None, "An exception was raised",
                                   "Exception type: {}".format(t))
    old_hook(t, val, tb)


old_hook = sys.excepthook
sys.excepthook = catch_exceptions

if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = gui.App()
    sys.exit(app.exec_())
    raise RuntimeError
Exemplo n.º 20
0
def testgui(qtbot):
    window = gui.App()
    qtbot.addWidget(window)
    window.show()
    assert window.isVisible()
def main():
    if os.path.exists("debug_log.txt"):
        os.remove("debug_log.txt")
    root = tk.Tk()
    app = gui.App(root, get_service())
    root.mainloop()
Exemplo n.º 22
0
    def run(self):
        """Execute relax.

        This is the application callback method executed by the multi-processor framework.
        """

        # Set up the warning system.
        lib.warnings.setup()

        # Logging.
        if self.log_file:
            io_streams_log(self.log_file)

        # Tee.
        elif self.tee_file:
            io_streams_tee(self.tee_file)

        # Show the version number and exit.
        if self.mode == 'version':
            print('relax ' + version.version_full())
            return

        # Show the relax info and exit.
        if self.mode == 'info':
            # Initialise the information box.
            info = Info_box()

            # Print the program intro.
            print(info.intro_text())

            # Print the system info.
            print(info.sys_info())

            # Stop execution.
            return

        # Run the interpreter for the prompt or script modes.
        if self.mode == 'prompt' or self.mode == 'script':
            # Run the interpreter.
            self.interpreter = interpreter.Interpreter()
            self.interpreter.run(self.script_file)

        # Execute the relax GUI.
        elif self.mode == 'gui':
            # Dependency check.
            if not dep_check.wx_module:
                sys.stderr.write(
                    "Please install the wx Python module to access the relax GUI.\n\n"
                )
                return

            # Only import the module in this mode (to improve program start up speeds).
            import gui

            # Set the GUI flag in the status object.
            status.show_gui = True

            # Start the relax GUI wx application.
            app = gui.App(script_file=self.script_file)
            app.MainLoop()

        # Execute the relax test suite
        elif self.mode == 'test suite':
            # Only import the module in the test modes (to improve program start up speeds).
            from test_suite.test_suite_runner import Test_suite_runner

            # Load the interpreter and turn intros on.
            self.interpreter = interpreter.Interpreter(show_script=False,
                                                       raise_relax_error=True)
            self.interpreter.on()

            # Run the tests.
            runner = Test_suite_runner(self.tests, timing=self.test_timings)
            runner.run_all_tests()

        # Execute the relax system tests.
        elif self.mode == 'system tests':
            # Only import the module in the test modes (to improve program start up speeds).
            from test_suite.test_suite_runner import Test_suite_runner

            # Load the interpreter and turn intros on.
            self.interpreter = interpreter.Interpreter(show_script=False,
                                                       raise_relax_error=True)
            self.interpreter.on()

            # Run the tests.
            runner = Test_suite_runner(self.tests, timing=self.test_timings)
            runner.run_system_tests()

        # Execute the relax unit tests.
        elif self.mode == 'unit tests':
            # Only import the module in the test modes (to improve program start up speeds).
            from test_suite.test_suite_runner import Test_suite_runner

            # Run the tests.
            runner = Test_suite_runner(self.tests, timing=self.test_timings)
            runner.run_unit_tests()

        # Execute the relax GUI tests.
        elif self.mode == 'GUI tests':
            # Only import the module in the test modes (to improve program start up speeds).
            from test_suite.test_suite_runner import Test_suite_runner

            # Run the tests.
            runner = Test_suite_runner(self.tests, timing=self.test_timings)
            runner.run_gui_tests()

        # Execute the relax verification tests.
        elif self.mode == 'verification tests':
            # Only import the module in the test modes (to improve program start up speeds).
            from test_suite.test_suite_runner import Test_suite_runner

            # Run the tests.
            runner = Test_suite_runner(self.tests, timing=self.test_timings)
            runner.run_verification_tests()

        # Test mode.
        elif self.mode == 'test':
            self.test_mode()

        # Licence mode.
        elif self.mode == 'licence':
            self.licence()

        # Unknown mode.
        else:
            raise lib.errors.RelaxError("The '%s' mode is unknown." %
                                        self.mode)
Exemplo n.º 23
0
# exec(open("gui.py").read(), globals())
import sys
from foldercount import numfile

import gui

exec(open('gatherimages.py').read())

train_q = gui.QApplication([])
train_app = gui.App('train')
# Continue training while there are images left in /images
while numfile('./training_data/like') + numfile(
        './training_data/dislike') < numfile('./images/'):
    train_app.photoChange('./images/')
train_q.quit()

predict_q = gui.QApplication([])
predict_app = gui.App('predict')

# sys.argv = ['gui.py','train']
# exec(open('gui.py').read())

# sys.argv = ['gui.py','predict']
# exec(open('gui.py').read())
Exemplo n.º 24
0
import gui as g
import tkinter as tk
import random as r
import pyautogui as auto


class player:
    def __init__(self):
        self.to_click = ()

    def get_origin(self):
        self.to_click = (r.randrange(3840), r.randrange(2160))
        while not game.origin_clicked:
            self.right_click(self.to_click)
            self.to_click = (r.randrange(3840), r.randrange(2160))

    def left_click(self, coords):
        auto.click(x=coords[0], y=coords[1])

    def right_click(self, coords):
        auto.click(x=coords[0], y=coords[1], button="right")


root = tk.Tk()  # Tkinter window is created
root.lift()
root.attributes("-topmost", True)  # window geometry and attributes are set
game = g.App(root)
game.mainloop()
p = player()
p.get_origin()
Exemplo n.º 25
0
def main():
    app = gui.App()
    del app
Exemplo n.º 26
0
import gui

a = gui.App()

# from Tkinter import *
# import hand
# import domino


# def removeDomino(value):
#     canvas.delete(ALL)
#     del b.dominoes[0]
#     b.displayHand(30, 10, canvas, orientation = "H")
#     print b

# def flipDomino(value):
#     print str(b ) + "Before"
#     canvas.delete(ALL)
#     b.dominoes[0].flip()
#     b.displayHand(30, 10, canvas, orientation = "H")
#     print str(b) + "After"

    
# root = Tk()
# canvas = Canvas(root, width = 400, height = 200)
# canvas.pack()
# a = [domino.Domino(), domino.Domino(), domino.Domino(), domino.Domino()]
# print a
# # for i in xrange(1, len(a) + 1):
# #     a[i-1].displayValue(canvas, x = i* 60, y = 10, orientation = "H")
#  #a.displayValue(canvas, 30, 10, orientation = "H")