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
#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 16:46.
[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
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
[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
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
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 13:25.