会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132465个问题
Python 全系列/第三阶段:Python 网络与并发编程/网络通信 34832楼

from tkinter import *
import webbrowser
from tkinter import messagebox

class Application(Frame):
    def __init__(self, master=None):
        super().__init__(master)
        self.master = master
        self.pack()
        self.createWidget()

    def createWidget(self):
        self.w1 = Text(self, width=40, height=12, bg="gray")
        self.w1.pack()
        self.w1.insert(1.0, "0123456789\nabcdefghijklmnopqrstuvwxyz")
        self.w1.insert(2.4, "锄禾日当午,汗滴禾下土。谁知盘中餐,粒粒皆辛苦\n")

        Button(self, text="重复插入文本").pack(side='left')
        Button(self, text="返回文本").pack(side='left')
        Button(self, text="插入图片").pack(side='left')
        Button(self, text="添加组件").pack(side='left')
        Button(self, text="通过tag精准控制文本",).pack(side='left')



if __name__ == '__main__':
    root = Tk()
    root.geometry("500x400+300+400")
    app = Application(master=root)
    root.mainloop()

老师请问一下,

self.w1 = Text(self, width=40, height=12, bg="gray")

这一句代码里面,我把Text的master改成了self,最后显示的布局是文本在上,选项在下

image.png

这个改变应该它们都在Application里面,然后先创建了Text对象然后再创建了下面一些列的Button对象,但是为什么master是root的时候选项会在文本框上面呢,Application不是在root里面的么?

image.png


Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 34836楼
WEB前端全系列/第五阶段:前后端交互/网络请求AJAX 34838楼

egoShop.zip

老师,我的项目现在可以正常运行,但是以import store 就会报错,视频里有些东西,vue3.0好像是更新了,和视频里不一样,老师麻烦您帮我看看,怎么能把数据存储到全局

WEB前端全系列/第二十阶段:Vue2企业级项目(旧)/Ego商城高级Vue实战项目 34840楼
JAVA 全系列/第五阶段:JavaWeb开发/Ajax技术详解(旧) 34842楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

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