AK Python
1.86K subscribers
39 photos
2 videos
11 files
236 links
Join here to unlock your programming ability
Download Telegram
import PySimpleGUI as sg
import time

# Basic timer in PSG

def Timer():
sg.theme('DarkAmber')

gui= [[sg.Text(size=(24, 10), font=('Bahnschrift ', 20),
justification='center', key='text')],
[sg.Button('Pause', key='-RUN-PAUSE-'),
sg.Button('Reset'),
sg.Exit(button_color=('white', 'firebrick4'))]]
window = sg.Window('AK Timer', gui,
no_titlebar=False, auto_size_buttons=True)

#logic started
i = 0
paused = False
start_time = int(round(time.time() * 100))

while True:
# This is the code that reads and updates your window
button, values = window.read(timeout=10)
window['text'].update('{:02d}:{:02d}.{:02d}'.format(
(i // 100) // 60, (i // 100) % 60, i % 100))

#conditions

if values is None or button == 'Exit':
break

if button == 'Reset':
i = 0

elif button == '-RUN-PAUSE-':
paused = not paused
window['-RUN-PAUSE-'].update('Run' if paused else 'Pause')

if not paused:
i += 1

window.close()

Timer()
👍1
from selenium import webdriver
import time

browser=webdriver.Chrome("D:\chromedriver.exe")
browser.get("https://www.instagram.com/")
time.sleep(4)

#Login
Username=browser.find_element_by_xpath("/html/body/div[1]/section/main/article/div[2]/div[1]/div/form/div/div[1]/div/label/input")
Username.send_keys("Username")
time.sleep(4)

Password=browser.find_element_by_xpath("/html/body/div[1]/section/main/article/div[2]/div[1]/div/form/div/div[2]/div/label/input")
Password.send_keys("Password")
Password.submit()
time.sleep(5)

#NotNow
Notnow=browser.find_element_by_xpath("/html/body/div[1]/section/main/div/div/div/div/button")
Notnow.click()
time.sleep(3)

#Notification
Noti=browser.find_element_by_xpath("/html/body/div[4]/div/div/div/div[3]/button[2]")
Noti.click()
time.sleep(3)

#Logic

def firstpic():
time.sleep(2)
pic=browser.find_element_by_class_name("_9AhH0")
pic.click()

def likepic():
time.sleep(3)
like=browser.find_element_by_xpath("/html/body/div[1]/section/main/section/div/div[2]/div/article[1]/div[3]/section[1]/span[1]/button")
like.click()

firstpic()
likepic()