会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132370个问题
Python 全系列/第二阶段:Python 深入与提高/游戏开发-坦克大战 2043楼
Python 全系列/第二阶段:Python 深入与提高/游戏开发-坦克大战 2044楼
Python 全系列/第二阶段:Python 深入与提高/游戏开发-坦克大战 2045楼
Python 全系列/第二阶段:Python 深入与提高/游戏开发-坦克大战 2046楼
Python 全系列/第二阶段:Python 深入与提高/游戏开发-坦克大战 2047楼
Python 全系列/第二阶段:Python 深入与提高/游戏开发-坦克大战 2050楼
Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 2051楼

#引入模块

import os                       #系统资源控制

import base64                   #文件加密

from tkinter import *           #写GUI

from secrets import token_bytes #生成密匙 


#全局

file_path = ''


#主界面类

class MyGui(Frame):

    def __init__(self,master= None):

        super().__init__(master)

        self.master = master #依赖窗口

        self.pack() #展示

        self.GreateWidget() #创建组件

    def GreateWidget(self):

        global file_path

        self.label01 = Label(self,text='文件路径')

        self.label01.grid(row = 0 ,column = 2)

        

        entry_tmp = StringVar()

        self.entry01 = Entry(self,textvariable = entry_tmp)

        self.entry01.grid(row = 1, column = 2)

        file_path = entry_tmp.get()


        self.button_encryed = Button(self,text= "加密" ,command = Encpryed_file)

        self.button_encryed.grid(row= 2,column = 1)


        self.button_dencryed = Button(self,text = '解密')

        self.button_dencryed.grid(row= 2,column = 2)


        self.button_exit = Button(self,text = '退出',command= self.master.destroy)

        self.button_exit.grid(row= 2,column = 3)


    #错误展示

    def error_display():

        pass

#获得密匙

def GetKeyWordPass():

    pass


#加密部分       

def Encpryed_file():

    print(file_path)


def decryption_file():

    pass



#主函数

def main():

    my_windos = Tk()

    my_windos.title('xxxx小软件')

    my_windos.geometry("250x100+200+100")

    app = MyGui(my_windos)

    my_windos.mainloop()


if __name__ == "__main__":

    main()


老师为什么我读不出entry_tmp变量里面的数据的

我次次读都是空的

图片.png

就是现实不出来


Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 2053楼
Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 2054楼
Python 全系列/第二阶段:Python 深入与提高/游戏开发-坦克大战 2055楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637