python 投票软件——含UI界面

本程序已有升级版:python 投票软件——含UI界面(优化版)_宋tongxue的博客-CSDN博客

今天为大家带来用python制作的一个投票软件

因为作者买不起服务器emmmmm所以只能使用邮箱这种相对免费的方法了

import easygui
from email.mime.text import MIMEText
from email.header import Header
from smtplib import SMTP_SSL
from easygui import*
import webbrowser
import smtplib  
host_server = 'smtp.qq.com'  #此处写发件邮箱的smtp地址
sender_qq = '[email protected]'   #这里写你的发件邮箱地址
pwd = 'xxxxxxxxxxxxxxx' #这里写邮箱授权码
sender_qq_mail = '[email protected]'  #还是写发件邮箱
receiver = '[email protected]'   #这里写收件邮箱
print("请不要随意输入,程序已内置判断条件")
lanrenmoshi = easygui.buttonbox("班级投票————此版本再次优化了判断逻辑,并精简了代码  python版制作人:宋勃逸  网页版制作人:徐睿博",choices =('开始投票','网页版投票/更新版本',"bug反馈"))

if lanrenmoshi=="网页版投票/更新版本":
    webbrowser.open_new_tab('          ')  #在这里写上更新地址
if lanrenmoshi=="bug反馈":
    mail_content = easygui.enterbox(msg="请输入你投的人的名字:",title = "bug反馈")
    mail_title = '投票'
    smtp = SMTP_SSL(host_server)
    smtp.set_debuglevel(1)
    smtp.ehlo(host_server)
    smtp.login(sender_qq, pwd)
    msg = MIMEText(mail_content, "plain", 'utf-8')
    msg["Subject"] = Header(mail_title, 'utf-8')
    msg["From"] = sender_qq_mail
    msg["To"] = receiver
    smtp.sendmail(sender_qq_mail, receiver, msg.as_string())
    smtp.quit()
    fankuiwancheng=easygui.buttonbox("bug反馈————感谢您对程序的支持",choices =("完事啦~~"))
if lanrenmoshi=="开始投票":    
    mail_content = multchoicebox(msg='请选择6个你要投的人,程序以内置判断,欸嘿', title='投票', choices=("张三","李四","王五","小明","小红","我不会起名字","我随便输入了","666"))
    if len(mail_content)>6 or len(mail_content)<6:
        mail_content = multchoicebox(msg='只能投6个人哦如果再不按照要求投,程序会直接跳出!!!', title='投票', choices=("张三","李四","王五","小明","小红","我不会起名字","我随便输入了","666"))
        if len(mail_content)>6 or len(mail_content)<6:
            qisiwola=easygui.buttonbox("不得不说,如果你能看到这行提示说明程序已经快被你玩坏了,emmmmm......  你这个样子让作者也很难做啊",choices =('下一步',))
            eihie=easygui.buttonbox("下次记得好好输入昂————",choices =("离开"))
        else:
            sender_qq = '    '  #和上面一样
            pwd = '      '#和上面一样
            sender_qq_mail = '      '#和上面一样
            receiver = '      '#和上面一样
            shuju=(" ".join(mail_content))
            mail_title = '投票'
            smtp = SMTP_SSL(host_server)
            smtp.set_debuglevel(1)
            smtp.ehlo(host_server)
            smtp.login(sender_qq, pwd)
            msg = MIMEText(shuju,'text','utf-8')
            msg["Subject"] = Header(mail_title, 'utf-8')
            msg["From"] = sender_qq_mail
            msg["To"] = receiver
            smtp.sendmail(sender_qq_mail, receiver, msg.as_string())
            smtp.quit()
            wanjisahua=lanrenmoshi = easygui.buttonbox("完结,撒花!",choices =('~离开~'))
    else:
        sender_qq = '        '   #依旧和上面一样
        pwd = '            '#依旧和上面一样
        sender_qq_mail = '       '#依旧和上面一样
        receiver = '       '#依旧和上面一样
        shuju=(" ".join(mail_content))
        mail_title = '投票'
        smtp = SMTP_SSL(host_server)
        smtp.set_debuglevel(1)
        smtp.ehlo(host_server)
        smtp.login(sender_qq, pwd)
        msg = MIMEText(shuju,'text','utf-8')
        msg["Subject"] = Header(mail_title, 'utf-8')
        msg["From"] = sender_qq_mail
        msg["To"] = receiver
        smtp.sendmail(sender_qq_mail, receiver, msg.as_string())
        smtp.quit()
        wanjisahua=lanrenmoshi = easygui.buttonbox("完结,撒花!",choices =('~离开~'))

怎么样,很简单吧

如有更好的解决办法可在评论区发表,或者邮箱发给作者

邮箱:[email protected]

你可能感兴趣的:(python,html,开发语言)