Python手写自己的ssr之界面编写

版权声明:原创 https://blog.csdn.net/qq_41058594/article/details/86988833

想必写代码的童鞋肯定都知道怎样科学上网,面向谷歌编程吧,那么怎样翻阅障碍越过大西洋,坐上飞机浏览世界最强搜索引擎呢?其中我比较喜欢用SSR,毕竟我觉得SSR界面比较好看:
我就突发奇想,自己用python搞个脚本,自己做一个可以ssr看可不可行,于是乎,大做起来,首先先建立SSR界面,仿作就要高仿,话不多说看代码!

# -*- coding: utf-8 -*-
"""
Created on Mon Feb 11 12:19:26 2019
@author: dell
"""
from tkinter import *
from PIL import Image,ImageTk
from  tkinter  import ttk
  
#-----------------------------------------------------------
window = Tk()
#整体窗口
window.title('编辑服务器(local:1080 Version4.1.5)')
window.resizable(0,0)
window.update()
window.geometry('1020x470')
#左边文本框
l1 = Entry(window)
l1.grid(ipadx=50,ipady=160,padx=10,pady=10)
#左边按钮
Button(window,text='添加(A)',\
       width=15, height=1).grid(row=5, column=0,padx=10,pady=5,sticky=W)
Button(window,text='删除(D)',\
       width=15, height=1).grid(row=5,column=0,padx=10,pady=5,sticky=E)

Button(window,text='上移',\
       width=15, height=1).grid(row=6, column=0,padx=10,pady=5,sticky=W)
Button(window,text='下移',\
       width=15, height=1).grid(row=6,column=0,padx=10,pady=5,sticky=E)
#中间框
#大标题
text = Label(window, text='服务器(截图注意打码)').place(x=265,y=5)
#复选框
#从上往下
var1 = IntVar()
Checkbutton(window, text=" *服务器 IP",\
            variable=var1).grid(row=0,column=1,
                         ipadx=5,ipady=20,padx=5,pady=22,sticky=NW)
#*服务器 IP密码框
e_pwd = Entry(window,width=35)
e_pwd['show']='*'
e_pwd.place(x=372,y=45)
#*服务器端口
text1 = Label(window, text=' *服务器端口').place(x=285,y=80)
text1_pwd = Spinbox(window,from_=2333,to=3000,width=34)
text1_pwd.place(x=372,y=80)
#*密码
var2 = IntVar()
Checkbutton(window, text=" *密码",variable=var2).place(x=300,y=110)
var2_pwd = Entry(window,width=35)
var2_pwd['show']='*'
var2_pwd.place(x=372,y=110)
#*加密
def go(*args):   #处理事件,*args表示可变参数
    print(comboxlist.get()) #打印选中的值

text2 = Label(window, text=' *加密').place(x=320,y=140)
text2_pwd = ttk.Combobox(window,textvariable=StringVar(),width=33)
text2_pwd.place(x=372,y=140)
text2_pwd["values"]=("none","aes-128-ctr",\
         "aes-192-ctr","aes-256-ctr",'aes-128-cfb','aes-192-cfb',\
         'aes-256-cfb','rc4','rc4-md5','rc4-md5-6','aes-128-cfb8',\
         'aes-192-cfb8','aes-256-cfb8','salsa20','chacha20','chacha20-ietf')
text2_pwd.current(1)  #选择第一个
text2_pwd.bind("<<ComboboxSelected>>",go)  #绑定事件,
#*协议
text3 = Label(window, text=' *协议',fg = '#9400D3').place(x=320,y=170)
text3_pwd = ttk.Combobox(window,textvariable=StringVar(),width=33)
text3_pwd.place(x=372,y=170)
text3_pwd["values"]=("plain","http_simple",\
         "http_post","random_head",'tls1.2_ticket_auth')
text3_pwd.current(0)  #选择第一个
text3_pwd.bind("<<ComboboxSelected>>",go)  #绑定事件,
#协议参数
text4 = Label(window, text=' 协议参数',fg = '#9400D3').place(x=300,y=200)
text4_pwd = Entry(window,width=35)
text4_pwd.place(x=372,y=200)
#*混淆
text5 = Label(window, text=' *混淆',fg = '#9400D3').place(x=320,y=230)
text5_pwd = ttk.Combobox(window,textvariable=StringVar(),width=33)
text5_pwd.place(x=372,y=230)
text5_pwd["values"]=("plain","http_simple",\
         "http_post","random_head",'tls1.2_ticket_auth')
text5_pwd.current(0)  #选择第一个
text5_pwd.bind("<<ComboboxSelected>>",go)  #绑定事件,
#混淆参数
text6 = Label(window, text=' 混淆参数',fg = '#9400D3').place(x=300,y=260)
text6_pwd = Entry(window,width=35)
text6_pwd.place(x=372,y=260)
#备注
text7 = Label(window, text=' 备注').place(x=325,y=290)
text7_pwd = Entry(window,width=35)
text7_pwd.place(x=372,y=290)
#Group
text8 = Label(window, text=' Group').place(x=313,y=320)
text8_pwd = Entry(window,width=35)
text8_pwd.place(x=372,y=320)
#SSR连接
var3 = IntVar()
Checkbutton(window, text=" SSR连接",variable=var2).place(x=283,y=350)
var3_pwd = Entry(window,width=35)
var3_pwd.place(x=372,y=350)
var3_pwd.insert(0,'ssr://MTcyLjEwNC44Mi4yNDA6MjMzMzphdXRoX3NoYTFfdjQ6YWVzLTEyOC1jdHI6cGxhaW46Wkc5MVlpNXBidy8_b2Jmc3BhcmFtPQ')
#高级选项
var4 = IntVar()
Checkbutton(window, text="高级选项",variable=var2).place(x=270,y=380)
text1 = Label(window, text='以下不是所有服务端都支持').place(x=400,y=380)
#确定,取消按钮
def chuachua():
    pass
Button(window,text='确定',command=chuachua,\
       width=15, height=1).place(x=283,y=410)
Button(window,text='取消',command=window.quit,\
       width=15, height=1).place(x=520,y=410)
#添加图片
load = Image.open('ssr.png')
render= ImageTk.PhotoImage(load)
img = Label(window,image=render)
img.image = render
img.place(x=650,y=50)

window.mainloop()
#-----------------------------------------

运行效果:
在这里插入图片描述
想了想,在各个组件排版和按钮函数运用之中,我突发奇想了好多可以实现的功能,这个只是开篇界面,往后接着补充完整,不过我个人感觉大家如果能自己写出某种界面我感觉tkinter就理解运用的差不多了!

欢迎大家学习python,大家一起交流,欢迎加QQ群(Python第一精神院)Python技术服务:634027520

猜你喜欢

转载自blog.csdn.net/qq_41058594/article/details/86988833