Skip to content

Commit

Permalink
resized
Browse files Browse the repository at this point in the history
  • Loading branch information
imvickykumar999 committed Nov 14, 2023
1 parent 7efa412 commit 75e2a7c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 12 deletions.
4 changes: 4 additions & 0 deletions Projects/TkinterGUI/ScrCpy_GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ def fun():
rely4 = 0.8
rely5 = 0.9

bg = PhotoImage(file = "wallpaper.png")
label = Label( root, image = bg)
label.place(x = 0, y = 0)

num_list = Listbox(root, height=15, width=30)
with open('keyevents.json') as f:
data = json.load(f)
Expand Down
Binary file added Projects/TkinterGUI/wallpaper.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 39 additions & 12 deletions ScrCpy/ScrCpy_GUI.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import os
import os, json
import threading
from tkinter import *

Expand Down Expand Up @@ -53,30 +53,57 @@ def submit(x):
except Exception as e:
print(e)

def fun():
key = num_list.get(num_list.curselection()[0])
key = key.split(' : ')[0]
os.system(f'adb -s {ip} shell input keyevent {key}')

while True:
root = Tk()

root.geometry("300x600")
root.title("ScrCpy GUI")

root.config(bg="gray")
event = StringVar()

btn1 = Entry(root, textvariable = event)
btn1.insert(0, '209') # Open Music App
btn1.place(relx=0.5, rely=0.1, anchor='center')
try:
rely3 = 0.7
rely4 = 0.8
rely5 = 0.9

num_list = Listbox(root, height=15, width=30)
with open('keyevents.json') as f:
data = json.load(f)

for i in data['key_events']:
j = data['key_events'][i]
k = j.split('adb shell input keyevent ')
num_list.insert(k[1], f'{k[1]} : {i.split("key_")[1]}')

num_list.place(relx=0.5, rely=0.4, anchor='center')
get_num_btn = Button(root, bg='green', text="Run ADB", command=fun)
get_num_btn.place(relx=0.5, rely=0.1, anchor='center')

except:
rely3 = 0.5
rely4 = 0.6
rely5 = 0.8

event = StringVar()
btn1 = Entry(root, textvariable = event)

btn1.insert(0, '209') # Open Music App
btn1.place(relx=0.5, rely=0.1, anchor='center')

btn2 = Button(root, bg='green', text = 'Keyevent', command=lambda: submit(event.get()))
btn2.place(relx=0.5, rely=0.2, anchor='center')
btn2 = Button(root, bg='green', text = 'Keyevent', command=lambda: submit(event.get()))
btn2.place(relx=0.5, rely=0.2, anchor='center')

btn3 = Button(root, text="Volume Up", command=volup)
btn3.place(relx=0.5, rely=0.5, anchor='center')
btn3.place(relx=0.5, rely=rely3, anchor='center')

btn4 = Button(root, text="Volume Down", command=voldown)
btn4.place(relx=0.5, rely=0.6, anchor='center')
btn4.place(relx=0.5, rely=rely4, anchor='center')

btn5 = Button(root, bg='red', text="Power ON / OFF", command=power)
btn5.place(relx=0.5, rely=0.8, anchor='center')
btn5.place(relx=0.5, rely=rely5, anchor='center')
root.mainloop()


Expand Down

0 comments on commit 75e2a7c

Please sign in to comment.