コード例 #1
0
def main():

    # Вступление
    start()

    # Работа на ферме
    work()

    # Последнее задание (подсчет веса и завершение программы)
    end()
コード例 #2
0
 def enter(self):
     self.loading()
     functions.start()
     print "What would you do?"
     print "1. Stay away from it. Run as fast as you can."
     print "2. Get inside and discover..."
     choice1 = raw_input("> ")
     if "2" in choice1:
         return 'tardis'
     else:
         return "death"
コード例 #3
0
ファイル: main.py プロジェクト: Tzakhima/wdep
def action(command):
    # Default region
    REGION = 'us-west-2'
    try:
        with shelve.open('regions', writeback=True) as db:
            REGION = db['default']
            print("Previous 'moveto' detected. Region: {}\n".format(REGION))
    except Exception:
        print("No previous 'moveto' detected. Region: {}\n".format(REGION))

    if command == "start":
        functions.start(REGION)
    elif command == "stop":
        functions.delete(REGION)
    elif command == "moveto":
        functions.moveto(REGION)
コード例 #4
0
ファイル: test_pytest.py プロジェクト: kocic11/scripts
def test_start():
    args = argparse.Namespace()
    args.env = "mockenv.json"
    args.instance = "testjcs"
    args.start = "start"
    args.email = False
    args.verbose = False
    _, response = start(args)
    assert requests.codes.ACCEPTED == response.status_code
コード例 #5
0
def easy_next(T, D, H, M, S, A, B):
    global temp_i, timed_i, timeh_i, timem_i, gasa_i, gasb_i
    temp_int = T

    timed_int = D
    timeh_int = H
    timem_int = M
    times_int = S

    time_s = timed_int * (86400) + timeh_int * (3600) + timem_int * (
        60) + times_int
    print(time_s)
    gasa_int = A
    gasb_int = B

    temp_i = str(T)
    timed_i = str(D)
    timeh_i = str(H)
    timem_i = str(M)
    gasa_i = str(A)
    gasb_i = str(B)

    frame_n = Frame(root)
    frame_n.grid()

    # Creating a restart if statement if Gas A + Gas B doesnt = 100%

    # Creating a restart if statement if Gas A + Gas B doesnt = 100%

    templ = Label(frame_n, text="Temperature for Test")
    timel = Label(frame_n, text="Time for Test")
    gasl = Label(frame_n, text="Gas % s")
    tempinput = "Steady State Temp = " + temp_i + "\N{DEGREE SIGN}C"
    timeinput = timed_i + " Days " + timeh_i +\
        "H " + timem_i + "min"
    gasainput = "Gas A = " + gasa_i + "%, Gas B = " + gasb_i + "%"
    f_templabel = Label(frame_n, text=tempinput)
    f_timelabel = Label(frame_n, text=timeinput)
    f_gaslabel = Label(frame_n, text=gasainput)
    frame_s.destroy()
    templ.grid(row=1, column=1)
    timel.grid(row=1, column=2)
    gasl.grid(row=1, column=3)
    f_templabel.grid(row=2, column=1)
    f_timelabel.grid(row=2, column=2)
    f_gaslabel.grid(row=2, column=3)

    # Creating Start button
    button_start = Button(
        frame_n,
        text="Start",
        command=lambda: start(temp_int, time_s, gasa_int, atm))
    button_start.grid(row=3, column=4)
    button_edit = Button(frame_n, text="edit", command=lambda: edit())
    button_edit.grid(row=4, column=4)
コード例 #6
0
def scan_finger():
    f.start()  #function to start the sensor
    f.start_led()  #function to start the led

    current_id = int(f.current_count(), 16)

    f.start_enroll(f.current_count(
    ))  #function for starting enrollment for storing the finger-print of user
    Lprint.lcd_byte(0x01, LCD_CMD)  #clear lcd
    Lprint.lcd_string("put your finger",
                      LCD_LINE_1)  #syntax for printing on lcd screen
    print 'press finger 1'
    while (f.ispressfinger() == 2):  #check if finger is pressed or not
        time.sleep(0.1)
    if (f.capture_image() == 1):  #capture image
        if (f.enroll1() == 1
            ):  #check if successfull enrollment of user has done or not
            print 'remove finger 1'
            Lprint.lcd_string("remove your finger",
                              LCD_LINE_1)  #syntax for printing on lcd screen
            while (f.ispressfinger() == 1):  #check if finger is pressed or not
                time.sleep(0.1)
            print 'press finger 2'
            Lprint.lcd_string("put your finger again",
                              LCD_LINE_1)  #syntax for printing on lcd screen
            while (f.ispressfinger() == 2):  #check if finger is pressed or not
                time.sleep(0.1)
            if (f.capture_image() == 1):  #capture image
                if (
                        f.enroll2() == 1
                ):  #check if successfull enrollment of user has done or not
                    print 'remove finger 2'
                    Lprint.lcd_string(
                        "remove your finger",
                        LCD_LINE_1)  #syntax for printing on lcd screen
                    while (f.ispressfinger() == 1
                           ):  #check if finger is pressed or not
                        time.sleep(0.1)
                    print 'press finger 3'
                    Lprint.lcd_string(
                        "put your finger again",
                        LCD_LINE_1)  #syntax for printing on lcd screen
                    while (f.ispressfinger() == 2
                           ):  #check if finger is pressed or not
                        time.sleep(0.1)
                    if (f.capture_image() == 1):  #capture image
                        if (
                                f.enroll3() == 1
                        ):  #check if successfull enrollment of user has done or not
                            print 'remove finger 3'
                            Lprint.lcd_string(
                                "successfull scanned:)",
                                LCD_LINE_1)  #syntax for printing on lcd screen
                            time.sleep(1)
                            Lprint.lcd_string(
                                "enter your mobile no",
                                LCD_LINE_1)  #syntax for printing on lcd screen

                            val1 = ''
                            val = ''
                            number = 0

                            while (val != 'D'):
                                Lprint.lcd_string(
                                    "then Press D ", LCD_LINE_2
                                )  #syntax for printing on lcd screen
                                val = keyboard.keyboard_value(
                                )  #calling the function to read the key pressed by the user on keypad
                                time.sleep(0.05)
                                val1 = val1 + val
                                if (val == 'C'):  #cancel command
                                    val1 = ''
                                    val = ''
                                    number = 0
                                    Lprint.lcd_string(
                                        "enter again", LCD_LINE_1
                                    )  #syntax for printing on lcd screen
                                    time.sleep(1.5)
                                elif (val != 'D'):  #varify end of mobile numer
                                    temp = int(val)
                                    number = number * 10 + temp  #store the number in variable
                                    Lprint.lcd_string(val1, LCD_LINE_1)

                            Lprint.lcd_byte(0x01, LCD_CMD)
                            Lprint.lcd_string(
                                "thank you..",
                                LCD_LINE_1)  #syntax for printing on lcd screen
                            time.sleep(1)
                            Lprint.lcd_byte(0x01, LCD_CMD)
                            Lprint.lcd_string(
                                "check sms in",
                                LCD_LINE_1)  #syntax for printing on lcd screen
                            Lprint.lcd_string(
                                "your mobile",
                                LCD_LINE_2)  #syntax for printing on lcd screen
                            time.sleep(2)
                            '''
                                send req. to server....
                                send Current_id and number
                            '''

                            url = "http://malgadi.co.in/touch-n-pay/register_new_user.php?fid=" + str(
                                current_id) + "&mobileno=" + str(number)
                            content = urllib2.urlopen(
                                url).read()  #syntax to update the web server
                            if (content == '1'):
                                Lprint.lcd_string(
                                    "registered successfully", LCD_LINE_1
                                )  #syntax for printing on lcd screen
                                time.sleep(2)
                                '''if internet is not working then delete id if not upload on portal'''

                            while (f.ispressfinger() == 1
                                   ):  #syntax if finger id pressed or not
                                time.sleep(0.1)

                            for i in range(
                                    0, 10):  # to store 10 digit mobile number
                                val = keyboard.keyboard_value()

                            val1 = ''
                            for i in range(0, 10):
                                val = keyboard.keyboard_value()
                                val1 = val1 + val  #to store number in string
                                Lprint.lcd_string(val1, LCD_LINE_2)

                                num.insert(i, val)
                                print num[i]
                            Lprint.lcd_string(
                                "check message in",
                                LCD_LINE_1)  #syntax for printing on lcd screen
                            Lprint.lcd_string(
                                "your phone",
                                LCD_LINE_2)  #syntax for printing on lcd screen
                            time.sleep(2)
                            userid = f.current_count(
                            )  # userid is in 'hex' format, covert it in decimal and minus 1

                            print 'user id is:'
                            print userid
                            '''
                                send req. to server....
                                send userid and num array
                            '''
                            while (f.ispressfinger() == 1):
                                time.sleep(0.1)

                        else:
                            Lprint.lcd_string(
                                "enroll 3 fail", LCD_LINE_1
                            )  #syntax for printing error message on lcd screen
                            Lprint.lcd_string(
                                "please try again",
                                LCD_LINE_2)  #syntax for printing on lcd screen
                            time.sleep(2)
                    else:
                        Lprint.lcd_string(
                            "3rd capture fail", LCD_LINE_1
                        )  #syntax for printing error message on lcd screen
                        Lprint.lcd_string(
                            "please try again",
                            LCD_LINE_2)  #syntax for printing on lcd screen
                        time.sleep(2)
                else:
                    Lprint.lcd_string(
                        "enroll 2 fail", LCD_LINE_1
                    )  #syntax for printing error message on lcd screen
                    Lprint.lcd_string(
                        "please try again",
                        LCD_LINE_2)  #syntax for printing on lcd screen
                    time.sleep(2)
            else:
                Lprint.lcd_string(
                    "2nd capture fail", LCD_LINE_1
                )  #syntax for printing error message on lcd screen
                Lprint.lcd_string(
                    "please try again", LCD_LINE_2
                )  #syntax for printing error message on lcd screen
                time.sleep(2)
        else:
            Lprint.lcd_string(
                "enroll 1 fail",
                LCD_LINE_1)  #syntax for printing error message on lcd screen
            Lprint.lcd_string(
                "please try again",
                LCD_LINE_2)  #syntax for printing error message on lcd screen
            time.sleep(2)
    else:
        Lprint.lcd_string(
            "1st capture fail",
            LCD_LINE_1)  #syntax for printing error message on lcd screen
        Lprint.lcd_string(
            "please try again",
            LCD_LINE_2)  #syntax for printing error message on lcd screen
        time.sleep(2)

    f.stop_led()
コード例 #7
0
        self.geometry("1024x550")

        container = ttk.Frame(self)
        container.pack(side="top", fill="both", expand=True)
        container.grid_rowconfigure(0, weight=1)
        container.grid_columnconfigure(0, weight=1)

        self.frames = {}

        lst_table = fn.getMenuItems()
        lst_table.append('empty')
        for tbl in lst_table:

            frame = Panel(container, self, tbl)
            self.frames[tbl] = frame
            frame.grid(row=0, column=0, sticky="nsew")

        self.show_frame("dashboard")

    def show_frame(self, cont):
        frame = self.frames[cont]
        self.title(fn.winTitle(cont.title()))
        frame.tkraise()


if __name__ == '__main__':
    if fn.checkAuth():
        fn.startMain()
    else:
        fn.start(Login)
コード例 #8
0
from settings import DIRECTORY
from functions import start

if __name__ == '__main__':
    start(DIRECTORY)
コード例 #9
0
import functions as check

check.start(summary=True, verbose=True, memory=True)

add = 2 + 2

check.point("ADDITION")

mult = 2 * 2

check.point("MULTIPLICATION")

exp = 2**2

check.point("EXPONENTIAL")

check.stop()
コード例 #10
0
ファイル: GUI.py プロジェクト: ElioThalmannCode/BinaryLife
class StartScreen(Screen):
    text = functions.start()
    yo = (f"Du bist {str(functions.year)} Jahre alt.")
    def update(self):
        self.text_field.text = functions.update()
        self.year_field.text = (f"Du bist {str(functions.year)} Jahre alt.")
コード例 #11
0
#The main file for the python game. 
import classes
import functions as fn


#fn.battle('Imp')
fn.charachter_select()

fn.start()
	

コード例 #12
0
from functions import start


print('Started battery tracker.')
print('note: each hour you will recieve toast notification or')
print('if the battery is less than or equal to 15% also if battery is greater than 90%.')

SECS = 60 * 60  # 1 hour

start(SECS)
コード例 #13
0
from selenium import webdriver
import Locators as locator
import functions as function
# navigate to website

#driver = webdriver.Chrome('./chromedriver')  # change as per your location

print('Select from the following')
print('1. Log in')
print('2. Create User')
print('3. Create Vendor')
print('4. Delete Vendor')
print('5. Associate Client and Vendor')
print('')
switch = int(input())
function.start()
if switch == 1:
#log_in
    function.login()

elif switch == 2:
#create user
    if function.login():

elif switch == 3:
# create vendor
   if function.login():
        function.CreateVendor()

elif switch == 4: # delete Vendor
コード例 #14
0
def next():
    global temp_i, timed_i, timeh_i, timem_i, gasa_i, gasb_i
    temp_int = int(e_temp.get())

    timed_int = int(e_timed.get())
    timeh_int = int(e_timeh.get())
    timem_int = int(e_timem.get())

    time_s = timed_int * (86400) + timeh_int * (3600) + timem_int * (60)
    print(time_s)
    gasa_int = int(e_gas1.get())
    gasb_int = int(e_gas2.get())

    temp_i = (e_temp.get())
    timed_i = e_timed.get()
    timeh_i = e_timeh.get()
    timem_i = e_timem.get()
    gasa_i = (e_gas1.get())
    gasb_i = (e_gas2.get())

    frame_n = Frame(root)
    frame_n.grid()

    # Creating a restart if statement if Gas A + Gas B doesnt = 100%
    if (gasa_int + gasb_int) != 100:
        frame_s.destroy()
        error_g = Label(
            frame_n,
            text="Gas A & Gas B do not add up to 100%, please restart program")
        error_g.pack()
        restart = Button(frame_n, text="Restart", command=restart_program)
        restart.pack()

    # Creating a restart if statement if Gas A + Gas B doesnt = 100%
    if temp_int < atm or temp_int > 120:
        frame_s.destroy()
        atm1 = str(atm)
        error_t = Label(frame_n,
                        text="Temperature is not within " + atm1 +
                        "\N{DEGREE SIGN}C to 120\N{DEGREE SIGN}C")
        error_t.pack()
        restart = Button(frame_n, text="Restart", command=restart_program)
        restart.pack()

    templ = Label(frame_n, text="Temperature for Test")
    timel = Label(frame_n, text="Time for Test")
    gasl = Label(frame_n, text="Gas % s")
    tempinput = "Steady State Temp = " + temp_i + "\N{DEGREE SIGN}C"
    timeinput = timed_i + " Days " + timeh_i +\
        "H " + timem_i + "min"
    gasainput = "Gas A = " + gasa_i + "%, Gas B = " + gasb_i + "%"
    f_templabel = Label(frame_n, text=tempinput)
    f_timelabel = Label(frame_n, text=timeinput)
    f_gaslabel = Label(frame_n, text=gasainput)
    frame_s.destroy()
    templ.grid(row=1, column=1)
    timel.grid(row=1, column=2)
    gasl.grid(row=1, column=3)
    f_templabel.grid(row=2, column=1)
    f_timelabel.grid(row=2, column=2)
    f_gaslabel.grid(row=2, column=3)

    # Creating Start button
    button_start = Button(
        frame_n,
        text="Start",
        command=lambda: start(temp_int, time_s, gasa_int, atm))
    button_start.grid(row=3, column=4)

    # Creating a Clear Button
    button_clear = Button(frame_n, text="Clear", command=restart_program)
    button_clear.grid(row=1, column=4)
コード例 #15
0
ファイル: control.py プロジェクト: TheNonexistent/GUIControl
 def connectsig(self, button):
     functions.start()
     setlable()