コード例 #1
0
ファイル: table.py プロジェクト: szkript/PokerAssistant
    def get_all(self, mode):
        print(self.__img_count)
        if mode is AssistantRunMode.EXTRACT:
            if self.__folder is None:
                self.__folder = input("choose folder: ")
            self.__current_file_name = f'desktop_screenshots\\{self.__folder}\\desktop-{self.__img_count}.jpg'
            self.__img_count += 1
        else:
            pyautogui.countdown(2)  # tmp solution
            self.__take_screenshot()

        # open image by filename and store its content in variable -> __table_img_loaded
        self.__load_image_to_memory()
        # crop table from __table_img_loaded and update with cropped image to serve as base table
        self.__table_img_loaded = Utils.crop_at_pos(self.__table_img_loaded,
                                                    self.__positions.table_pos)
        Utils.save_image(self.__table_img_loaded,
                         self.__GATHERING_FOLDER + "\\current_table.jpg")
        self.__crop_table_objects()
        self.__recognize_objects()
        table_objects = dict(hand=self.__hand,
                             middle=self.__middle,
                             dealer_position=self.__dealer_position,
                             buttons=self.__buttons)
        return table_objects
コード例 #2
0
def sendTeamsMessage(contact, message):
    # alerts and waits for user to switch to the Microsoft Teams window
    print('Please switch to the Microsoft Teams application/window.')
    print('Starting in ', end='')
    pyautogui.countdown(5)

    # performs shortcut to the search bar and enters the contact to search for
    pyautogui.hotkey('ctrl', 'e')
    pyautogui.write(contact)

    # put program to sleep for one second to allow search results to display
    time.sleep(1)

    pyautogui.press('down')
    pyautogui.press('enter')

    # put program to sleep for one second to allow chat to display
    time.sleep(1)

    # writes and sends message
    pyautogui.write(message)
    pyautogui.press('enter')
コード例 #3
0
def open_webex(url):
    ##
    ##  Open_Webex Method
    ##
    cb.moveTo(57, 1055)  # <-- Move's mouse to Search Bar
    cb.click()

    cb.countdown(2)

    cb.moveTo(108, 1008)
    cb.click()

    cb.countdown(2)

    cb.typewrite('webex')

    cb.countdown(1)

    cb.typewrite(['enter'])

    cb.countdown(2)

    cb.moveTo(1294, 338)
    cb.click()
    cb.countdown(2)

    cb.typewrite(url)
    print("TYPED")
    cb.countdown(5)

    cb.moveTo(1370, 334)
    cb.click()
    cb.countdown(5)

    cb.moveTo(1007, 700)
    cb.click()
    cb.countdown(15)

    cb.moveTo(700, 569)
    cb.click()
    cb.countdown(5)

    cb.moveTo(780, 994)  # chat button
    cb.click()
    cb.countdown(5)

    cb.moveTo(1560, 963)
    cb.click()
    cb.countdown(5)

    cb.moveTo(1527, 989)
    cb.click()
    cb.countdown(5)

    cb.moveTo(1527, 989)
    cb.click()
    cb.countdown(5)

    for i in range(100):
        cb.typewrite("Hello Mr. Rice, How Are YOU?")
        cb.typewrite(['enter'])

    print("-------------------------------------------------------------")
    print("Done")
コード例 #4
0
    # Ensure the file you end with is the same as the one you start with
    with open(FilePath, "rb") as FileObject:
        bytes = FileObject.read()
        filehash = hashlib.md5(bytes).hexdigest()

except:
    UsingClipboard = True
    print("Trying clipboard contents.")
    clipboard = Tk().clipboard_get()

if UsingClipboard:
    print(f"Clipboard: {clipboard[0:15]}...")
else:
    print(f"File: {FilePath}")

print("Waiting for user to select text field to type in...")
print("Starting in ", end='')
pyautogui.countdown(10)

if UsingClipboard:
    pyautogui.write(clipboard, 0.001)
else:
    with open(FilePath) as FileObject:
        for Line in FileObject:
            print(f"Typing: {Line}")
            pyautogui.write(Line, 0.001)
            print(
                f"Ensure the hash of the destination file matches the following\nmd5 hash: {filehash}"
            )

print("Typing complete.")
コード例 #5
0
ファイル: main.py プロジェクト: duvickcedu/Piano_Tiles_Bot
            print("t3")
            click(2922, 684)


def tile4():
    while not keyboard.is_pressed('esc'):
        if py.pixel(3021, 684)[0] == R:
            print("t4")
            click(3021, 684)


# Each row get a thread that watches for a clickable tile.
if __name__ == '__main__':
    py.FAILSAFE = True
    print("Countdown", end=' ')
    py.countdown(5)
    t1 = threading.Thread(target=tile1)
    t2 = threading.Thread(target=tile2)
    t3 = threading.Thread(target=tile3)
    t4 = threading.Thread(target=tile4)
    t1.start()
    t2.start()
    t3.start()
    t4.start()
    t1.join()
    t2.join()
    t3.join()
    t4.join()

# if py.pixel(TILE_LEFT[0], TILE_LEFT[1])[0] == R:
#     click(TILE_LEFT[0], TILE_LEFT[1])
コード例 #6
0
ファイル: main.py プロジェクト: hiwony7933/python_basic
answer_li = []  # 답안 깡통 list 만들고

# txt 파일의 답안은 엔터방식
f = open("./answer.txt", "r")
answer_li = f.readlines()
f.close()

for i in range(len(answer_li)):
    answer_li[i] = answer_li[i].strip().replace(" ",
                                                "")  # 맨마지막 list 에 공란이 들어가서 지움

push = ""

while push != "stop":
    answer_Text = ""  # 정답 초기화
    pag.countdown(3)
    if not answer_li:
        print("정답이 모두 소진되었습니다.")
        break
    else:
        answer_Text = random.choice(answer_li)  # 정답 list 에서 랜덤으로 객체 불러오기
        answer_li.remove(answer_Text)

        Text_li = list(answer_Text)  # 정답 단어의 list 처리
        Text_len = len(answer_Text)  # 정답 단어의 총 글자 수
        Text_IP_list = list("-" * Text_len)  # 정답 단어의 총 글수 만큼 하이픈 처리

        Text_use_IP_text = ""  # 답안제출 변수, 없어도 되는데 어떤 변수인지 보기 쉽게 하기 위해서
        Empty_Text_li = []  # 유저가 입력하는 답안의 저장 list 화 (중복제외)

        while True:  # 목숨에 대한 입력 에러 처리 반복문
コード例 #7
0
#! python3

# pnudge.py - nudges the mouse slightly when an interval of time passes

import pyautogui

try:

    while True:

        pyautogui.countdown(30)
        pyautogui.move(25, 25, duration = 0.3)


except KeyboardInterrupt:
    print("Done.")
コード例 #8
0
ファイル: test_2.py プロジェクト: abhishek-honey/python
import java.util.Set;

public class TwoPlusTwo {
	public static void main(String[] args) {
		int[] arr = new int[] { 1, 3, 5, 8, 7, 6 };
		int requiredSum = 8;

		getIntegerForSum(arr, requiredSum);
	}

	private static void getIntegerForSum(int[] arr, int requiredSum) {
		Set<Integer> differenceSet = new HashSet<>();
		for (int i = 0; i < arr.length; i++) {
			if (differenceSet.contains(arr[i])) {
				System.out.println(arr[i] + ", " + (requiredSum - arr[i]));
			} else {
				differenceSet.add(requiredSum - arr[i]);
			}
		}
	}
}
"""

# pyautogui.press(s)
pyautogui.countdown(5)
for c in s:
    pyautogui.typewrite(c)
    playsound('/Users/apple/code/github/python/keyboard.mp3')

# pyautogui.typewrite(s, interval=0.01)