본문 바로가기

PROGRAM

(92)
여러개의 유사한 역할을 하는 QspinBox를 하나의 함수로 처리 https://stackoverflow.com/questions/74863602/python-how-to-pass-a-qspinbox-value-together-with-other-parameters-to-a-slot Python - How to pass a QSpinBox value together with other parameters to a slot? It's quite straightforward to process a valueChanged signal of a single QSpinBox with a dedicated slot: class MainWindow(QMainWindow): self.ui.spinbox.valueChanged.connect(self.slot) def stackover..
폴더 생성하기-기존 폴더가 있으면 다음 번호로 폴더 생성하기 - 폴더를 생성하는데 기존에 폴더가 존재하면 그다음 번호로 폴더 생성 예) capture_01, capture_02 폴더가 있으면 capture_03폴더 생성 import os def make_folders(folder_path): num = 1 while True: fname = folder_path + '_' + f'{num:02d}' if not os.path.exists(fname): os.makedirs(fname) break else: num += 1 continue if __name__ == '__main__': folder_path = 'captures' make_folders(folder_path)
원하는 폴더위치 탐색기 창으로 열기 코드를 실행하는 위치(현재폴더)를 탐색기 창으로 띄우기 #현재 폴더 탐색기 창 열기 import os path = os.path.realpath('.') os.startfile(path) 내가 원하는 절대경로를 지정하고 지정한 위치를 탐색기 창으로 열기 C:\Temp라는 폴더를 탐색기창으로 열기 #절대 경로 지정하여 폴더 탐색기 창 열기 import os # target_path = 'c:/Temp' # path = os.path.realpath(target_path) # os.startfile(path) target_path = 'c:/Temp' os.startfile(os.path.realpath(target_path))
다중모니터 활성화된 화면 정보 얻기 Pyqt5에서 designer를 사용하여 테스트 중 1. 주모니터가 1인경우 모든 모니터 정보를 출력하면 > 주 모니터 정보를 먼저 출력함 - DISPLAY1 => DISPLAY2 순임 - 모니터1이 기준으므로 왼쪽의 모니터2는 마이너스 좌표임 from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QDialog, QWidget, QDesktopWidget from PyQt5.QtCore import Qt, QPoint import sys from PyQt5 import uic form_sub = uic.loadUiType('qwin_v4_sub.ui')[0] class myMain(QMainWindow, form_sub): def __init__..
이름 입력받아 테두리에 별 찍기 #include #include #include void get_your_info(char* name, int* pad) { printf("이름을 입력하세요>"); gets(name); printf("공백의 수를 입력하세요>"); scanf_s("%d", pad); } int main() { char myName[20]; int pad, rows, stars; get_your_info(myName, &pad); //printf("%s %d\n", yourName,pad); //printf("size : %d %d\n", strlen("Hello,"), strlen(myName)); rows = 2 * pad + 3; stars = strlen("Hello,") + strlen(myName) + 2 * p..
버튼 클릭시 이미지 전환(여러개) 1. 그림파일 드래그해 넣기 --> res/drawable 폴더에 마우스로 파일을 이동함 버튼 및 이미지 구성하기 ( 기호는 : 임 ) activity_main.xml MainActivity.java public class MainActivity extends AppCompatActivity { private Button btn_prev, btn_next; private ImageView imageView; int NumImages[] = {R.drawable.number1,R.drawable.number2, R.drawable.number3,R.drawable.number4,R.drawable.number5, R.drawable.number6,R.drawable.number7}; int coun..
KeyEvent - continue2 보호되어 있는 글입니다.
KeyEvent - continue 보호되어 있는 글입니다.