会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 133539个问题

老师这个程序运行后,怎么没有菜单显示?哪里出问题了。

"""开发记事本软件的菜单"""
from tkinter import *
from tkinter.filedialog import *
from tkinter.colorchooser import *


class Application(Frame):

    def __init__(self,master=None):
        super().__init__(master)

        self.master = master
        self.textpad = None
        self.pack()
        self.createWidget()

    def createWidget(self):
        # 创建主菜单栏
        menubar = Menu(root)
        # 创建子菜单
        menuFile = Menu(menubar)
        menuEdit = Menu(menubar)
        menuHelp = Menu(menubar)
        # 将子菜单加入到主菜单栏
        menubar.add_cascade(label="文件(F)", menu=menuFile)
        menubar.add_cascade(label="编辑(E)", menu=menuEdit)
        menubar.add_cascade(label="帮助(H)", menu=menuHelp)
        # 添加菜单项
        menuFile.add_command(label="新建", accelerator="ctrl+n",command=self.test)
        menuFile.add_command(label="打开", accelerator="ctrl+o",command=self.test)
        menuFile.add_command(label="保存", accelerator="ctrl+s",command=self.test)
        menuFile.add_separator()  # 添加分割线
        menuFile.add_command(label="退出", accelerator="ctrl+q",command=self.test)

        # 将主菜单栏加到根窗口
        root["menu"] = menubar

        # 文本编辑区
        self.textpad = Text(root, width=50, height=30)
        self.textpad.pack()


    def test(self):
        pass



if __name__ == '__main__':
    root = Tk()
    root.geometry("450x300+200+300")
    root.title("百战程序员的简易记事本")
    app = Application(master=root)
    root.mainloop()


Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 4997楼
Python 全系列/第十六阶段:Python 爬虫开发/Python爬虫基础与应用 4999楼

captcha_study.zip

老师,你好这是我照着老师的步骤来的,为什么我的验证码输入正确还是显示验证码错误,能帮我看看哪里出错了吗?为啥我的request.post.get()这个函数没获取到值

Python 全系列/第十二阶段:Python_Django3框架/Django进阶 5001楼
JAVA 全系列/第四阶段:数据库与AI协同技术实战/SQL 语言 5002楼

希望能尽快解决,不然工具用不了,买的课不就白买了

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was

14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"



 One of the configured repositories failed (未知),

 and yum doesn't have enough cached data to continue. At this point the only

 safe thing yum can do is fail. There are a few ways to work "fix" this:


     1. Contact the upstream for the repository and get them to fix the problem.


     2. Reconfigure the baseurl/etc. for the repository, to point to a working

        upstream. This is most often useful if you are using a newer

        distribution release than is supported by the repository (and the

        packages for the previous distribution release still work).


     3. Run the command with the repository temporarily disabled

            yum --disablerepo=<repoid> ...


     4. Disable the repository permanently, so yum won't use it by default. Yum

        will then just ignore the repository until you permanently enable it

        again or use --enablerepo for temporary usage:


            yum-config-manager --disable <repoid>

        or

            subscription-manager repos --disable=<repoid>


     5. Configure the failing repository to be skipped, if it is unavailable.

        Note that yum will try to contact the repo. when it runs most commands,

        so will have to try and fail each time (and thus. yum will be be much

        slower). If it is a very temporary problem though, this is often a nice

        compromise:


            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true


Cannot find a valid baseurl for repo: base/7/x86_64

大数据全系列/第三阶段:Linux 操作系统/Linux操作系统概述与安装 5003楼
Python 全系列/第二十三阶段:人工智能基础_机器学习理论和实战(旧)/无约束最优化问题的求解算法 5004楼
Python 全系列/第一阶段:Python入门/序列 5007楼
JAVA 全系列/第一阶段:AI驱动的JAVA编程/面向对象详解和JVM底层内存分析 5008楼
Python 全系列/第十二阶段:Python_Django3框架/Django初级 5010楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

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