|
发表于 2020-5-15 08:10:12
|
显示全部楼层
本楼为最佳答案

- from tkinter import *
- import time
- from pyperclip import copy
- import pyautogui as g
- root = Tk()
- root.title('连续发送器(怼人神器)')
- root.geometry('400x400')
- def paste(chinese):
- copy(chinese)
- g.hotkey('ctrl', 'v')
- # pyinstaller -F -w text.py
- def a():
- a_g = str(a.get('0.0', 'end'))
- b_g = int(b.get())
- c_g = int(c.get())
- time.sleep(c_g)
- #g.moveTo(1588, 802, duration = 1)
- #g.click()
- if (v_c.get()) == 1:
- for i in range(b_g):
- # 输入l like python
- #g.typewrite(a_g)
- paste(a_g)
- # 按下回车
- g.press('enter')
- time.sleep(0.01)
- elif (v_c.get()) == 2:
- for i in range(b_g):
- # 输入l like python
- #g.typewrite(a_g)
- paste(a_g)
- # 按下回车
- g.press('ctrl'+'enter')
- time.sleep(0.01)
- frame = Frame(root)
- frame.place(x = 120, y = 50)
- b = Button(root, text = '发送(请先点击要发送的位置)', font = ('楷书', 18), bg = 'yellow', command = a)
- b.place(x = 10, y = 340)
- Label(root, text = ' 内容 ', font = ('楷书', 18), bg = 'yellow').place(x = 10, y = 50)
- gun_song_tiao_y = Scrollbar(frame)
- gun_song_tiao_x = Scrollbar(frame, orient=HORIZONTAL)
- a = Text(frame, font = ('楷书', 18), fg = 'blue', width=20, height=7 ,wrap='none')
- gun_song_tiao_y.pack(side=RIGHT,fill=Y)
- gun_song_tiao_x.pack(side=BOTTOM, fill=X)
- a.pack()
- gun_song_tiao_y.config(command=a.xview)
- gun_song_tiao_x.config(command=a.yview)
- a.config(yscrollcommand=gun_song_tiao_y.set)
- a.config(xscrollcommand=gun_song_tiao_x.set)
- Label(root, text = '发送次数', font = ('楷书', 18), bg = 'yellow').place(x = 10, y = 300)
- var1 = StringVar()
- var1.set('20')
- b = Entry(root, font = ('楷书', 18), bg = 'yellow', fg = 'blue', textvariable=var1)
- b.place(x = 120, y = 300)
- var = StringVar()
- var.set('5')
- Label(root, text='准备时间', font = ('楷书', 18), bg = 'yellow').place(x = 10, y = 10)
- c = Entry(root, font = ('楷书', 18), bg = 'yellow', fg = 'blue', textvariable=var)
- c.place(x = 120, y = 10)
- Label(root, text='发送方式', font = ('楷书', 18), bg = 'yellow').place(x=10, y=250)
- v_c = IntVar()
- v_c.set(1)
- enter_r = Radiobutton(root ,text='Enter' ,font = ('楷书', 17), variable = v_c, value=1)
- enter_r.place(x=120, y=250)
- c_enter_r = Radiobutton(root, text='Ctrl+Enter', variable = v_c, value=2 ,font = ('楷书', 17))
- c_enter_r.place(x=210 ,y=250)
- root.mainloop()
复制代码
设个最佳吧
这个代码我也是写了很长时间的    |
|