Results 1 to 6 of 6

Thread: Program

  1. #1
    Member
    Join Date
    Aug 2019
    Location
    Finglas
    Posts
    80
    Thanks
    2
    Thanked 2 Times in 1 Post

    Program

    Program that control computer (control program). This program you can't close and you can control computer by eyes by use this program.

    from tkinter import *


    root = Tk()


    pressed_f4 = False # Is Alt-F4 pressed?


    def do_exit():
    global pressed_f4
    print('Trying to close application')
    if pressed_f4: # Deny if Alt-F4 is pressed
    print('Denied!')
    pressed_f4 = False # Reset variable
    else:
    close() # Exit application


    def alt_f4(event): # Alt-F4 is pressed
    global pressed_f4
    print('Alt-F4 pressed')
    pressed_f4 = True


    def close(*event): # Exit application
    root.destroy()


    root.bind('<Alt-F4>', alt_f4)
    root.bind('<Escape>', close)
    root.protocol("WM_DELETE_WINDOW",do_exit)


    root.mainloop()


    import zmq
    from pymouse import PyMouse


    #mouse setup
    m = PyMouse()
    x_dim, y_dim = m.screen_size()


    #network setup
    context = zmq.Context()
    socket = context.socket(zmq.SUB)
    socket.connect("tcp://127.0.0.1:5000")
    #filter by messages by stating string 'STRING'. '' receives all messages
    socket.setsockopt(zmq.SUBSCRIBE, '')
    smooth_x, smooth_y= 0.5, 0.5


    while True:
    msg = socket.recv()
    items = msg.split("\n")
    msg_type = items.pop(0)
    items = dict([i.split(':') for i in items[:-1] ])
    if msg_type == 'Pupil':
    try:
    my_gaze = items['norm_gaze']


    if my_gaze != "None":
    raw_x,raw_y = map(float,my_gaze[1:-1].split(','))


    # smoothing out the gaze so the mouse has smoother movement
    smooth_x += 0.5 * (raw_x-smooth_x)
    smooth_y += 0.5 * (raw_y-smooth_y)


    x = smooth_x
    y = smooth_y


    y = 1-y # inverting y so it shows up correctly on screen
    x *= x_dim
    y *= y_dim
    # PyMouse or MacOS bugfix - can not go to extreme corners
    # because of hot corners?
    x = min(x_dim-10, max(10,x))
    y = min(y_dim-10, max(10,y))


    m.move(x,y)
    except KeyError:
    pass
    else:
    # process non gaze position events from plugins here
    pass



    Last edited by pacalovasjurijus; 9th August 2020 at 15:46.

  2. #2
    Member
    Join Date
    Aug 2019
    Location
    Finglas
    Posts
    80
    Thanks
    2
    Thanked 2 Times in 1 Post

    ​[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]import cv2, time[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]import pyautogui[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]from time import time[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]first_frame = None
    _author__ = 'The control software has been written Jurijus Pacalovas.'[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]print(_author__)[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]print("Program that control computer (control program). By this program you can control computer by eyes. I enjoy writing programs. I like writing programs.")
    namez = input("Please, enter for move mouse 1, 2, 3, 4, 5, 6, 7 ")
    w1=0
    q1=0[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]rt1=0
    rt2=0
    rt3=0
    rt4=0[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]qmoveanywhere1=0
    if namez=="6":
    w1=0

    qmoveanywhere1=0
    if namez=="1":
    w1=100
    [/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]if namez=="2":
    w1=200
    [/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]if namez=="3":
    w2=300
    [/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]if namez=="4":
    w1=400
    [/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]if namez=="5":
    w1=500[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]if namez=="7":
    qmoveanywhere1=1

    video = cv2.VideoCapture(0)[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]
    x=0
    x1=0
    x2=0
    x = time()[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]while True:
    check, frame = video.read()

    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    gray = cv2.GaussianBlur(gray,(21,21),0) [/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] if first_frame is None:
    first_frame = gray [/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] delta_frame = cv2.absdiff(first_frame, gray)
    thresh_frame = cv2.threshold(delta_frame, 30, 255, cv2.THRESH_BINARY)[1]
    thresh_frame = cv2.dilate(thresh_frame, None, iterations = 2) [/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] cnts = cv2.findContours(thresh_frame.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)[0][/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] for contour in cnts:
    if cv2.contourArea(contour) < 1000:
    continue
    (x, y, w, h) = cv2.boundingRect(contour)
    cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 3)
    [/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] if qmoveanywhere1==1 and x>=200 and x<=255 or qmoveanywhere1==1 and y>=200 and y<=255:
    w1=200[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] if qmoveanywhere1==1 and x>=400 and x<=455 or qmoveanywhere1==1 and y>=400 and x<=455:
    w1=400[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] if qmoveanywhere1==1 and x>=500 and x<=555 or qmoveanywhere1==1 and y>=500 and x<=555:
    w1=500[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] if qmoveanywhere1==1 and x>=0 and x<=50 or qmoveanywhere1==1 and x>=0 and y<=50:
    w1=0[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] if qmoveanywhere1==1 and x>=256 and x<=305 or qmoveanywhere1==1 and y>=300 and y<=355:
    w1=200[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] if qmoveanywhere1==1 and x<=400 and x>=355 or qmoveanywhere1==1 and y>=400 and y<=455:
    w1=500


    w=x+w1
    h=y+w1


    if x>=1:
    rt1=x
    rt2=y[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] if x>=2:
    rt3=x
    rt4=y

    pyautogui.click(w, h)

    x=0
    x1=0
    x2=0
    x = time()


    pyautogui.moveTo(w, h, duration = 1)

    [/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] cv2.imshow("Gray Frame", gray)
    cv2.imshow("Delta Frame", delta_frame)
    cv2.imshow("Threshold Frame", thresh_frame)
    cv2.imshow("Color Frame", frame)[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] key = cv2.waitKey(1)
    print(gray)
    print(delta_frame)[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] if key == ord('q'):
    break[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]video.release()
    cv2.destroyAllWindows
    [/FONT]

    Last edited by pacalovasjurijus; 9th August 2020 at 15:44.

  3. #3
    Member
    Join Date
    Aug 2019
    Location
    Finglas
    Posts
    80
    Thanks
    2
    Thanked 2 Times in 1 Post


    ​[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]import cv2, time[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]import pyautogui[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]from time import time[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]first_frame = None
    _author__ = 'The control software has been written Jurijus Pacalovas.'[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]print(_author__)[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]print("Program that control computer (control program). By this program you can control computer by eyes. I enjoy writing programs. I like writing programs.")
    namez = input("Please, enter for move mouse 1, 2, 3, 4, 5, 6, 7 ")
    w1=0
    q1=0[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]rt1=0
    rt2=0
    rt3=0
    rt4=0[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]qmoveanywhere1=0
    if namez=="6":
    w1=0

    qmoveanywhere1=0
    if namez=="1":
    w1=100
    [/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]if namez=="2":
    w1=200
    [/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]if namez=="3":
    w2=300
    [/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]if namez=="4":
    w1=400
    [/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]if namez=="5":
    w1=500[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]if namez=="7":
    qmoveanywhere1=1

    video = cv2.VideoCapture(0)[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]
    x=0
    x1=0
    x2=0
    x = time()[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]while True:
    check, frame = video.read()

    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    gray = cv2.GaussianBlur(gray,(21,21),0) [/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] if first_frame is None:
    first_frame = gray [/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] delta_frame = cv2.absdiff(first_frame, gray)
    thresh_frame = cv2.threshold(delta_frame, 30, 255, cv2.THRESH_BINARY)[1]
    thresh_frame = cv2.dilate(thresh_frame, None, iterations = 2) [/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] cnts = cv2.findContours(thresh_frame.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)[0][/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] for contour in cnts:
    if cv2.contourArea(contour) < 1000:
    continue
    (x, y, w, h) = cv2.boundingRect(contour)
    cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 3)
    [/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] if qmoveanywhere1==1 and x>=200 and x<=255 or qmoveanywhere1==1 and y>=200 and y<=255:
    w1=200[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] if qmoveanywhere1==1 and x>=400 and x<=455 or qmoveanywhere1==1 and y>=400 and x<=455:
    w1=400[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] if qmoveanywhere1==1 and x>=500 and x<=555 or qmoveanywhere1==1 and y>=500 and x<=555:
    w1=500[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] if qmoveanywhere1==1 and x>=0 and x<=50 or qmoveanywhere1==1 and x>=0 and y<=50:
    w1=0[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] if qmoveanywhere1==1 and x>=256 and x<=305 or qmoveanywhere1==1 and y>=300 and y<=355:
    w1=200[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] if qmoveanywhere1==1 and x<=400 and x>=355 or qmoveanywhere1==1 and y>=400 and y<=455:
    w1=500


    w=x+w1
    h=y+w1


    if x>=1:
    rt1=x
    rt2=y[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] if x>=2:
    rt3=x
    rt4=y

    pyautogui.click(w, h)

    x=0
    x1=0
    x2=0
    x = time()


    pyautogui.moveTo(w, h, duration = 1)

    [/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] cv2.imshow("Gray Frame", gray)
    cv2.imshow("Delta Frame", delta_frame)
    cv2.imshow("Threshold Frame", thresh_frame)
    cv2.imshow("Color Frame", frame)[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] key = cv2.waitKey(1)
    print(gray)
    print(delta_frame)[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] if key == ord('q'):
    break[/FONT]
    [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]video.release()
    cv2.destroyAllWindows
    [/FONT]

    Attached Files Attached Files
    Last edited by pacalovasjurijus; 9th August 2020 at 17:05.

  4. #4
    Member
    Join Date
    Aug 2019
    Location
    Finglas
    Posts
    80
    Thanks
    2
    Thanked 2 Times in 1 Post
    Eyes 1.0.0.1 Control program
    Attached Files Attached Files
    Last edited by pacalovasjurijus; 9th August 2020 at 17:06.

  5. #5
    Member
    Join Date
    Aug 2019
    Location
    Finglas
    Posts
    80
    Thanks
    2
    Thanked 2 Times in 1 Post
    We enjoy writing programs. We like writing programs.
    Last edited by pacalovasjurijus; 23rd August 2020 at 15:01.

  6. #6
    Member
    Join Date
    Aug 2019
    Location
    Finglas
    Posts
    80
    Thanks
    2
    Thanked 2 Times in 1 Post
    Software is a collection of data or computer instructions that tell the computer how to work.

    Application Software is a program or group of programs designed for end users.

    A computer programmer, sometimes called a software developer, a programmer or more recently a coder (especially in more informal contexts), is a person who creates computer software. The term computer programmer can refer to a specialist in one area of computers, or to a generalist who writes code for many kinds of software. A programming language is a notation for writing programs. I enjoy writing programs. I write software.


    A computer programmer: sometimes called a software developer, a programmer or more recently a coder.
    A programming language is a notation for writing programs.
    I enjoy writing programs. I write software. Reverso context


    In my free time, I like writing programs, writing software, creating applications, writing compression software, control software and programs in python.

    Programma International was one of the first personal computer software publishers. Esta blished in the late 1970s by David Gordon, it published a line of approximately 300 game, programming utility, and office productivity products for the Apple II, Commodore PET,TRS-80 and other personal computer systems. Hayden Publishing bought Programma International in 1980 and the company went out of business in 1983.

    Welcome to Python! This tutorial will show you how to start writing programs.

    A program is a set of instructions used to control the behaviour of a machine. Examples of such programs include:

    A computer program (software)
    Last edited by pacalovasjurijus; 3rd September 2020 at 12:25.

Similar Threads

  1. How to write a program that let to see shadows?
    By pacalovasjurijus in forum The Off-Topic Lounge
    Replies: 0
    Last Post: 24th June 2020, 18:32
  2. Replies: 4
    Last Post: 17th February 2018, 12:03
  3. A C++ Skeleton Program For Data Compression
    By greatalazar in forum The Off-Topic Lounge
    Replies: 1
    Last Post: 4th January 2018, 10:54
  4. RTIME - New freeware program
    By LovePimple in forum The Off-Topic Lounge
    Replies: 3
    Last Post: 4th July 2008, 10:47
  5. XTIME - New freeware program
    By LovePimple in forum The Off-Topic Lounge
    Replies: 4
    Last Post: 4th July 2008, 03:40

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •