import linuxcnc
s = linuxcnc.stat()
s.poll()
rC = root_window.tk.call
rE = root_window.tk.eval


##################################################
#####           camera tab   ######################
#############################################
# new probe tab in top.tabs
rC('.pane.top.tabs','insert','end','cam','-text',' cam ')
rC('.pane.top.tabs.fcam','configure','-borderwidth',2)

##########################################
###   the opencv stuff 



import cv2 as cv

cap = cv.VideoCapture(0);

cap.set(3, 360)
cap.set(4, 360)
print(cap.get(3))
print(cap.get(4))
#cap.set = 720 X 720
#3 = 600 = 300
#4 = 800 = 400
#
#cap.set = 360 X 360
#3=352.0 = 176
#4=288.0 = 144

while(True):
    ret, frame = cap.read()

#    horz = cv.line(frame, (0, 300), (800, 300), (0, 0, 255), 1)
    horz = cv.line(frame, (0, 144), (352, 144), (0, 0, 255), 1)
    
#    vert = cv.line(frame, (400, 0), (400, 600), (0, 0, 255), 1)
    vert = cv.line(frame, (176, 0), (176, 352), (0, 0, 255), 1)
    
    cv.imshow('Top_CamView', frame)
    
    if cv.waitKey(1) & 0xff == ord('q'):
        break
        
cap.release()
cv.destroyAllWindows()




##################################################
#####      /     camera tab   ######################
#############################################




commands = TclCommands(root_window)
