鱼C论坛

 找回密码
 立即注册
查看: 2320|回复: 1

[已解决]按钮摆放位置换位place之后就无法显示了

[复制链接]
发表于 2020-2-26 16:34:51 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. from tkinter import *


  2. class App():
  3.     def __init__(self, master):
  4.         self.root = master#定义内部变量root
  5.         #self.root.config()
  6.         self.root.title('1611班学生信息管理系统')
  7.         self.root.geometry('%dx%d' % (600, 400))  # 设置窗口大小

  8.         choice(self.root)

  9. class choice():
  10.     def __init__(self, master):
  11.         self.master = master
  12.         #self.master.config(bg='green')
  13.         # 基准界面choice
  14.         self.choice = Frame(self.master )
  15.         self.choice.pack()
  16.         btn1 = Button(self.choice, text = '教师')
  17.         btn1.place(x = 400,y = 200)

  18. if __name__ == '__main__':
  19.     root = Tk()
  20.     App(root)
  21.     root.mainloop()
复制代码
最佳答案
2020-2-26 16:40:49
  1. from tkinter import *


  2. class App:
  3.     def __init__(self, master):
  4.         self.root = master  # 定义内部变量root
  5.         # self.root.config()
  6.         self.root.title('1611班学生信息管理系统')
  7.         self.root.geometry('%dx%d' % (600, 400))  # 设置窗口大小

  8.         choice(self.root)


  9. class choice:
  10.     def __init__(self, master):
  11.         self.master = master
  12.         # self.master.config(bg='green')
  13.         # 基准界面 choice
  14.         self.choice = Frame(self.master, width=600, height=400)
  15.         btn1 = Button(self.choice, text='教师')
  16.         btn1.place(x=400, y=200)
  17.         self.choice.pack()


  18. if __name__ == '__main__':
  19.     root = Tk()
  20.     App(root)
  21.     root.mainloop()
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2020-2-26 16:40:49 | 显示全部楼层    本楼为最佳答案   
  1. from tkinter import *


  2. class App:
  3.     def __init__(self, master):
  4.         self.root = master  # 定义内部变量root
  5.         # self.root.config()
  6.         self.root.title('1611班学生信息管理系统')
  7.         self.root.geometry('%dx%d' % (600, 400))  # 设置窗口大小

  8.         choice(self.root)


  9. class choice:
  10.     def __init__(self, master):
  11.         self.master = master
  12.         # self.master.config(bg='green')
  13.         # 基准界面 choice
  14.         self.choice = Frame(self.master, width=600, height=400)
  15.         btn1 = Button(self.choice, text='教师')
  16.         btn1.place(x=400, y=200)
  17.         self.choice.pack()


  18. if __name__ == '__main__':
  19.     root = Tk()
  20.     App(root)
  21.     root.mainloop()
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 1 反对 0

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-5-2 10:23

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表