鱼C论坛

 找回密码
 立即注册
查看: 3874|回复: 0

[吹水] 我想按钮按下才让函数起作用

[复制链接]
发表于 2021-4-9 23:24:25 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#author:毛毛雨
from tkinter import *
import socket
yipin_address=('localhost',41235)
s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)

def execute(msg):
    msg1=msg.encode('utf-8')
    print(msg1)
    s.sendto(msg1,yipin_address)   
list=["B004D100010E","B004D200011E","B004D300012E","B003D100110E","B003D100211E","B003D100312E","B003D100413E","B003D100514E","B003D100615E","B003D100716E","B003D100817E","B003D100918E"]
root = Tk()
frame1 = Frame(root)
frame2 = Frame(root)
frame3 = Frame(frame2)
frame4 = Frame(frame2)
root.title('易拼控制')#给窗口的可视化起名字
root.geometry('500x300')#设置窗口的大小
hi_there = Button(frame1,text="播放",width=15,height=3,font=('12'),command=execute(list[0]))
hi_there.pack()
hi_these = Button(frame1,text="暂停",width=15,height=3,font=('12'),command=execute(list[1]))
hi_these.pack()
hi_these = Button(frame1,text="停止",width=15,height=3,font=('12'),command=execute(list[2]))
hi_these.pack()
hi_there = Button(frame1,text="下一个",width=15,height=3,font=('12'),command=execute(list[3]))
hi_there.pack()
hi_these = Button(frame3,text="影片一",width=15,height=2,font=('12'),command=execute(list[4]))
hi_these.pack()
hi_these = Button(frame3,text="影片二",width=15,height=2,font=('12'),command=execute(list[5]))
hi_these.pack()
hi_these = Button(frame3,text="影片三",width=15,height=2,font=('12'),command=execute(list[6]))
hi_these.pack()
hi_these = Button(frame3,text="影片四",width=15,height=2,font=('12'),command=execute(list[7]))
hi_these.pack()
hi_these = Button(frame4,text="影片五",width=15,height=2,font=('12'),command=execute(list[8]))
hi_these.pack()
hi_these = Button(frame4,text="影片六",width=15,height=2,font=('12'),command=execute(list[9]))
hi_these.pack()
hi_these = Button(frame4,text="影片七",width=15,height=2,font=('12'),command=execute(list[10]))
hi_these.pack()
hi_these = Button(frame4,text="影片八",width=15,height=2,font=('12'),command=execute(list[11]))
hi_these.pack()

frame1.pack(padx=3,pady=3,side=LEFT)
frame2.pack(padx=3,pady=3,side=RIGHT)
frame3.pack(padx=10,pady=10,side=LEFT)
frame4.pack(padx=10,pady=10,side=RIGHT)

root.mainloop()
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-11-15 08:27

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表