반응형
반응형

Program made with Python and Pygame module for visualizing sorting algorithms

Support this project by leaving a ⭐

 

  • Run: python3 src/main.py

https://github.com/LucasPilla/Sorting-Algorithms-Visualizer/tree/master

 

GitHub - LucasPilla/Sorting-Algorithms-Visualizer: Program made with Python and Pygame module for visualizing sorting algorithms

Program made with Python and Pygame module for visualizing sorting algorithms - GitHub - LucasPilla/Sorting-Algorithms-Visualizer: Program made with Python and Pygame module for visualizing sorting...

github.com

반응형
반응형

KeyboardEvent keyCode

<!DOCTYPE html>
<html>
<body>
<h1>Keyboard Events</h1>
<h2>The keyCode Property</h2>

<p>Press a keyboard key in the input field and display the value:</p>

<input type="text" size="40"   onkeypress="myFunction(event)">

<p id="demo"></p>
<p>The keyCode property is deprecated, use the key property instead.</p>

<script>
function myFunction(event) {
  let value= event.which;
  document.getElementById("demo").innerHTML = value;
}  
</script> 
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
	$("#inp").keypress(function(e){
		//검색어 입력 후 엔터키 입력하면 조회버튼 클릭
		if(e.keyCode && e.keyCode == 13){
			$("#btn").trigger("click");
			return false;
		}
		//엔터키 막기
		if(e.keyCode && e.keyCode == 13){
			  e.preventDefault();	
		}
	});
	$("#btn").click(function(){
		alert("이벤트 감지");
	});
});
</script>
<input type="text" class="form-control input-sm" id="inp" name="inp">
<button type="button" class="btn btn-primary btn-sm" id="btn" name="btn">조회</button>
</body>
</html>

 

 

반응형
반응형

[python] Use Phone Camera with python 

 

https://thecleverprogrammer.com/2021/01/05/use-phone-camera-with-python/

 

Use Phone Camera with Python | Aman Kharwal

In this article, I will walk you through how to use your phone camera with Python for computer vision. Use the Phone Camera with Python.

thecleverprogrammer.com

install CV : https://pypi.org/project/opencv-python/  

""" https://thecleverprogrammer.com/2021/01/05/use-phone-camera-with-python/

    https://pypi.org/project/opencv-python/
    > pip install opencv-python
    > pip install opencv-contrib-python
"""
import cv2
import numpy as np

url = "Your IP Address/video"

cap = cv2.VideoCapture(url)

while(True):
    camera, frame = cap.read()
    if frame is not None:
        cv2.imshow("Frame", frame)
    q = cv2.waitKey(1)
    if q==ord("q"):
        break

cv2.destroyAllWindows()

 

https://stackoverflow.com/questions/50185654/opencv-load-video-from-url

 

OpenCV load video from url

I have a video file (i.e. https://www.example.com/myvideo.mp4) and need to load it with OpenCV. Doing the equivalent with an image is fairly trivial: imgReq = requests.get("https://www.example.com/

stackoverflow.com

 

 

 

반응형
반응형

Google 지도 서비스용 Python 클라이언트

파이썬을 사용합니까? 무언가를 지오코딩하고 싶습니까? 방향을 찾고 계십니까? 아마도 방향의 행렬일까요? 이 라이브러리는 Google Maps Platform 웹 서비스를 Python 애플리케이션에 제공합니다.

Google Maps Services용 Python 클라이언트는 다음 Google Maps API용 Python 클라이언트 라이브러리입니다.

  • 길찾기 API
  • 거리 행렬 API
  • 고도 API
  • 지오코딩 API
  • 지리적 위치 API
  • 시간대 API
  • 도로 API
  • 장소 API
  • 지도 정적 API
  • 주소 확인 API

 

요구 사항

  • 파이썬 3.5 이상.
  • Google 지도 API 키입니다.

API 키

각 Google 지도 웹 서비스 요청에는 API 키 또는 클라이언트 ID가 필요합니다. API 키는 Google Cloud Console 'API 및 서비스' 탭의 '사용자 인증 정보' 페이지에서 생성됩니다 .

Google Maps Platform 시작하기 및 API 키 생성/제한에 대한 자세한 내용은 Google 문서에서 Google Maps Platform 시작하기를 참조하세요.

중요: 이 키는 서버에서 비밀로 유지되어야 합니다.

설치

$ pip install -U googlemaps

연결/읽기 제한 시간을 지정하려면 요청 2.4.0 이상이 필요합니다.

 

 

https://pypi.org/project/googlemaps/

 

googlemaps

Python client library for Google Maps Platform

pypi.org

 

https://github.com/googlemaps/google-maps-services-python

 

GitHub - googlemaps/google-maps-services-python: Python client library for Google Maps API Web Services

Python client library for Google Maps API Web Services - GitHub - googlemaps/google-maps-services-python: Python client library for Google Maps API Web Services

github.com

 

반응형
반응형

반응형
반응형

파이썬 컴파일 위치에 따라 import에 이슈가 발생하곤 한다. 

파일 실행시 이미지가 상대경로라면

프로그램 파일 상단에 작업디렉토리 변경을 통해서 현재 파일의 이슈를 줄일 수 있다. 

 

1.현재 파일의 이름 & 경로

import os

#현재 파일 이름
print(__file__)

#현재 파일 실제 경로
print(os.path.realpath(__file__))

#현재 파일 절대 경로
print(os.path.abspath(__file__))

2.현재 파일의 디렉토리 경로

import os

#현재 폴더 경로; 작업 폴더 기준
print(os.getcwd())

#현재 파일의 폴더 경로; 작업 파일 기준
print(os.path.dirname(os.path.realpath(__file__)))

3.현재 디렉토리의 파일 리스트

import os
print(os.listdir(os.getcwd()))

4.작업 디렉토리 변경

import os
os.chdir("/home/dada/test/")
반응형

+ Recent posts