Go to advanced search

by NickAsk
Sat Jul 11, 2020 12:34 pm
Forum: Python
Topic: python how to stop getch() ?
Replies: 4
Views: 183

Re: python how to stop getch() ?

I want to stop this input.

Code: Select all

import getch

while(True):
     inp = getch.getch()
     
I want to stop this inp , but I do not want to stop the whole program.
How can I do it?
by NickAsk
Thu Jul 09, 2020 9:06 pm
Forum: Python
Topic: python how to stop getch() ?
Replies: 4
Views: 183

python how to stop getch() ?

Hello everybody. I have wrote a program in python using getch() function to recieve inputs from user and I want to stop this input in specific times How can I achieve that? example => key_passwrd = getch.getch() Also , curses.endwin() works fine ,if I use this one: control = curses.initscr() curses....
by NickAsk
Sun Jun 28, 2020 9:39 pm
Forum: General discussion
Topic: python3 can't use normal input and curses at the same time - problem
Replies: 3
Views: 146

python3 can't use normal input and curses at the same time - problem

Hello I have a problem in my python 's code. I use curses input to get inputs from user ,when I press "a" ,do this ,when "m" is pressed ,do something else . When I press "v" ,I call a function that has inside another input(the normal input we know,for example : a = input("Give a number") ) But the p...
by NickAsk
Wed Jun 24, 2020 6:53 pm
Forum: General discussion
Topic: python3 camera on/off problem
Replies: 9
Views: 240

Re: python3 camera on/off problem

Ok,I think I did it. Code: import cv2 cap = cv2.VideoCapture(0) cap.set(3 , 320) cap.set(4 , 240) def open_camera(capture): global cap if(capture): ret , frame = cap.read() if(ret): cv2.imshow("I see you !!!" , frame) else: cap = cv2.VideoCapture(0) cap.set(3 , 320) cap.set(4 , 240) if(cv2.waitKey(1...
by NickAsk
Wed Jun 24, 2020 6:42 pm
Forum: General discussion
Topic: python3 camera on/off problem
Replies: 9
Views: 240

Re: python3 camera on/off problem

import cv2 cap = cv2.VideoCapture(0) cap.set(3 , 320) cap.set(4 , 240) def open_camera(capture): global cap if(capture): ret , frame = cap.read() if(ret): cv2.imshow("I see you !!!" , frame) else: print("ret is false") if(cv2.waitKey(1) == ord('c')): cap.release() cv2.destroyAllWindows() capture = ...
by NickAsk
Wed Jun 24, 2020 6:06 pm
Forum: General discussion
Topic: python3 camera on/off problem
Replies: 9
Views: 240

Re: python3 camera on/off problem

I have read that "ret" obtains return value from getting the camera frame, either true of false
if I omit it ,I get an error ->

Code: Select all

TypeError: Expected Ptr<cv::UMat> for argument 'mat'
So ,what can I do to solve this problem?

Thanks!!
by NickAsk
Wed Jun 24, 2020 5:22 pm
Forum: General discussion
Topic: python3 camera on/off problem
Replies: 9
Views: 240

Re: python3 camera on/off problem

Any help here?
by NickAsk
Wed Jun 24, 2020 9:06 am
Forum: General discussion
Topic: python3 camera on/off problem
Replies: 9
Views: 240

Re: python3 camera on/off problem

yes,my fault. You're right
by NickAsk
Wed Jun 24, 2020 7:42 am
Forum: General discussion
Topic: python3 camera on/off problem
Replies: 9
Views: 240

python3 camera on/off problem

Hello. I'm trying to figure out and solve a problem in my code without result. I have a file in which I have a function to open camera. import cv2 cap = cv2.VideoCapture(0) cap.set(3, 320) cap.set(4 , 240) def open_camera(capture): if(capture): ret , frame = cap.read() cv2.imshow("I see you !!!" , f...
by NickAsk
Tue Jun 23, 2020 8:04 pm
Forum: General discussion
Topic: Communication beetween 2 rasPi
Replies: 25
Views: 616

Re: Communication beetween 2 rasPi

Anyway,thanks again!!
by NickAsk
Tue Jun 23, 2020 7:51 pm
Forum: General discussion
Topic: Communication beetween 2 rasPi
Replies: 25
Views: 616

Re: Communication beetween 2 rasPi

Thanks for the update , but I don't want communication via wifi/internet.
Can these 2 raspberries communicate via usb cable or rx/tx pins ?
If yes ,can you provide me an example/program(code) or a specific link between them?

Thanks a lot !!!!!
by NickAsk
Tue Jun 23, 2020 12:50 pm
Forum: General discussion
Topic: Communication beetween 2 rasPi
Replies: 25
Views: 616

Re: Communication beetween 2 rasPi

#1 : rasp. pi 4 model B
#2 : rasp. pi 3 model B
by NickAsk
Tue Jun 23, 2020 12:25 pm
Forum: General discussion
Topic: Communication beetween 2 rasPi
Replies: 25
Views: 616

Communication beetween 2 rasPi

Hello
If I have 2 raspberry pi and I have a program running on rasPi #1 and another program (a function) running on rasPi #2 and I connect it via usb ,how can I call the function from rasPi #2 to the program running on raPi #1 ,using python3 ?
by NickAsk
Tue Jun 23, 2020 8:05 am
Forum: General discussion
Topic: python3 camera opencv terminate the whole program
Replies: 6
Views: 222

Re: python3 camera opencv terminate the whole program

But,I want to release the window ,without close the whole program.
by NickAsk
Tue Jun 23, 2020 6:54 am
Forum: General discussion
Topic: Other part of program sticks with camera using opencv
Replies: 3
Views: 151

Re: Other part of program sticks with camera using opencv

Ok I'm sorry
The waitkey function waits a few ms for user input but I want to have an input that don't need to wait not at all.
So my question is how can I replace waitkey with another input that don't need to wait.

Thanks.
by NickAsk
Mon Jun 22, 2020 8:26 pm
Forum: General discussion
Topic: python3 camera opencv terminate the whole program
Replies: 6
Views: 222

Re: python3 camera opencv terminate the whole program

Yes ,the window closes and the problem is that the whole program terminates,but in the code I don't tell it to terminate the whole program ,I just say to set the camera off and and keep doing other things...
by NickAsk
Mon Jun 22, 2020 8:23 pm
Forum: General discussion
Topic: Other part of program sticks with camera using opencv
Replies: 3
Views: 151

Other part of program sticks with camera using opencv

Hello.I have a program and a part of it is to open a camera with opencv Another part of program is to give inputs using curses(do NOT wait/stop the other parts of program until user give an input ) But when I open a camera AND then give an input the program sticks a little bit and this is very very ...
by NickAsk
Mon Jun 22, 2020 12:10 pm
Forum: General discussion
Topic: python3 camera opencv terminate the whole program
Replies: 6
Views: 222

python3 camera opencv terminate the whole program

Hello. I have a problem with a program in python3 and I want your help!! I have a function to open my camera using opencv (function -> open_camera() ) Then I have another part of program which is running with open_camera() at the SAME time and it works VERY GOOD , but when I press 'c' button to rele...
by NickAsk
Sat Jun 20, 2020 10:06 pm
Forum: General discussion
Topic: python3 colour print
Replies: 4
Views: 142

Re: python3 colour print

I used return ,but I got the same error
by NickAsk
Sat Jun 20, 2020 9:17 pm
Forum: General discussion
Topic: python3 colour print
Replies: 4
Views: 142

python3 colour print

Hello. I want to print a word with colour by calling a function ,but I get an error.How can I fix it ? I want to call these colours by functions , because the program is big . Code: def green_colour(): Green_message = "\u001b[32m" def reset_colour(): Reset_message = "\u001B[0m" print(green_colour() ...
by NickAsk
Fri Jun 19, 2020 8:05 pm
Forum: General discussion
Topic: python3 getch() == null ?
Replies: 7
Views: 306

Re: python3 getch() == null ?

Hello again. I tried to run this code that someone sent me (Thank you!!!) and it works fine . Code: import curses import time b = True end = time.time() def ooo(): stdscr = curses.initscr() curses.noecho() stdscr.nodelay(1) # set getch() non-blocking stdscr.addstr(0,0,"Write something:\n") line = 1 ...
by NickAsk
Thu Jun 18, 2020 8:08 pm
Forum: General discussion
Topic: python3 getch() == null ?
Replies: 7
Views: 306

Re: python3 getch() == null ?

Is there a way to check if a button has not been pressed?
by NickAsk
Thu Jun 18, 2020 7:10 pm
Forum: General discussion
Topic: python3 getch() == null ?
Replies: 7
Views: 306

Re: python3 getch() == null ?

I will describe my problem with an example.
I have a led and I want to blink it every 0.5 seconds and I have an input .
If input == "a" ,do something ,but I don't want to stop led blinking.

Go to advanced search