Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Tkiner,框架位于中间_Python_Tkinter - Fatal编程技术网

Python Tkiner,框架位于中间

Python Tkiner,框架位于中间,python,tkinter,Python,Tkinter,我目前正在制作一个messenger程序。正如您在标题中所看到的,我使用Tkinter在框架内部创建了一个框架,并且内部框架自动垂直对齐。但我不想要这个。他们总是想从头开始。当帧内有大量帧时,这是正常的,但如果没有,问题就会出现。当然,这是因为我对“Tkinter”缺乏了解,但我仍然需要你的帮助。我认为帧的“”事件或类列表中的帧有问题 用韩语道歉 将tkinter作为tk导入 从中国进口* memberInfo=[(1,'ukhyun','1234','하욱현', '01024021051',

我目前正在制作一个messenger程序。正如您在标题中所看到的,我使用Tkinter在框架内部创建了一个框架,并且内部框架自动垂直对齐。但我不想要这个。他们总是想从头开始。当帧内有大量帧时,这是正常的,但如果没有,问题就会出现。当然,这是因为我对“Tkinter”缺乏了解,但我仍然需要你的帮助。我认为帧的“”事件或类列表中的帧有问题

用韩语道歉

将tkinter作为tk导入
从中国进口*
memberInfo=[(1,'ukhyun','1234','하욱현', '01024021051', 'hyun4911@gmail.com","ukhyun.png",,
(2,'ukhyun1','1234','하욱현1', '01024021051', 'hyun4911@gmail.com“,”ukhyun1.png“,
(3、‘ukhyun2’、‘1234’、‘监狱’、‘01024021051’、'hyun4911@gmail.com“,”jail.png“,
(4,'ukhyun','1234','welcome','01024021051','hyun4911@gmail.com“,”welcome.png“,
(5,'ukhyun3','1234','hello','01024021051','hyun4911@gmail.com“,”hello.png“,
(6,'ukhyun','1234','welcome','01024021051','hyun4911@gmail.com“,”welcome.png“,
(7,'ukhyun3','1234','hello','01024021051','hyun4911@gmail.com“,”hello.png“,
(8,'ukhyun','1234','welcome','01024021051','hyun4911@gmail.com“,”welcome.png“,
(9,'ukhyun3','1234','hello','01024021051','hyun4911@gmail.com“,”hello.png“,
(10,'ukhyun','1234','welcome','01024021051','hyun4911@gmail.com“,”welcome.png“,
(11,'ukhyun3','1234','hello','01024021051','hyun4911@gmail.com“,”hello.png“,
(12、‘ukhyun’、‘1234’、‘welcome’、‘01024021051’、'hyun4911@gmail.com“,”welcome.png“,
(13,'ukhyun3','1234','hello','01024021051','hyun4911@gmail.com“,”hello.png“,
(14、‘ukhyun’、‘1234’、‘welcome’、‘01024021051’、'hyun4911@gmail.com“,”welcome.png“,
(15,'ukhyun3','1234','hello','01024021051','hyun4911@gmail.com“,”hello.png“,
(16、‘ukhyun’、‘1234’、‘welcome’、‘01024021051’、'hyun4911@gmail.com“,”welcome.png“,
(17,'ukhyun3','1234','hello','01024021051','hyun4911@gmail.com“,”hello.png“,
(18、‘ukhyun’、‘1234’、‘welcome’、‘01024021051’、'hyun4911@gmail.com“,”welcome.png“,
(19,'ukhyun3','1234','hello','01024021051','hyun4911@gmail.com“,”hello.png“)]
类main应用程序(tk.Frame):
定义初始值(自、父、*args、**kwagrs):
tk.Frame.\uuuuu init\uuuuuu(self,parent,*args,**kwagrs)
self.parent=parent
self.config(bg=“白色”)
员工=员工名单(自我)
类列表(tk.Frame):
定义初始值(自、父、*args、**kwagrs):
tk.Frame.\uuuuu init\uuuuuu(self,parent,*args,**kwagrs)
self.config(bg='red')
self.pack(fill='both',expand=True)
self.vScrollBar=tk.Scrollbar(self,orient=tk.VERTICAL)
self.vScrollBar.pack(fill='y',side='right')
self.canvas=tk.canvas(
self,bg='blue',bd=0,highlightthickness=0,yscrollcommand=self.vScrollBar.set)
self.canvas.pack(fill='both',side='left',expand=True)
self.vScrollBar.config(命令=self.canvas.yview)
self.interior=tk.Frame(self.canvas,bg=“黑色”)
self.interior.pack(fill='both')
self.interiorId=self.canvas.create\u窗口(
0,0,窗=自内,锚定='nw')
def_配置_内部(e):
大小=(self.interior.winfo_reqwidth(),
self.interior.winfo_reqheight())
self.canvas.config(scrollregion=self.interior.bbox('all'))
打印(self.canvas.yview)
如果self.interior.winfo_reqwidth()!=self.canvas.winfo_width():
self.canvas.config(width=self.interior.winfo_reqwidth())
self.interior.bind(“,\u configure\u interior)
定义配置画布(e):
如果self.interior.winfo_reqwidth()!=self.canvas.winfo_width():
self.canvas.itemconfigure(
self.interiorId,width=self.canvas.winfo_width())
self.canvas.bind(“,\u configure\u canvas)
def_车轮(e):
self.canvas.yview_卷轴(圆形(-1*(e.delta/120)),“单位”)
self.canvas.bind_all(“,_wheel)
对于getmembers中的i(self.canvas.yview):
印刷品(一)
打印(self.canvas.yview)
班级统计表(列表):
定义初始化(自、父、*args、**kwargs):
列表。\uuuuu初始化(self、parent、*args、**kwargs)
self.users=[]
self.imgs=[]
对于范围(3)中的i:
self.users.append(tk.Frame(self.interior,bd=0,bg='red'))
self.users[-1].pack(side='top',fill='x')
tk.Label(self.users[-1],text=“hello”).pack()
如果名称=“\uuuuu main\uuuuuuuu”:
root=tk.tk()
root.title(“Messenger-GoodAuction”)
root.minsize(400500)
根几何体('400x600+200+200')
root.iconbitmap(默认值=r“/img/favicon.ico”)
app=mainApplication(root).pack(side=“top”、fill=“both”、expand=True)
root.mainloop()

不确定我是否理解正确,但看看这是否正确; 您有三个垂直包装的标签:

hello
hello
hello
self.users[-1].pack(side='top', fill='x')
                           ^
packs vertically ----------|
但我希望他们能:

hello hello hello
在这种情况下;在calss
staffList()
中,明确垂直打包:

hello
hello
hello
self.users[-1].pack(side='top', fill='x')
                           ^
packs vertically ----------|
但您可以将其更改为:

self.users[-1].pack(side='left', fill='x')
                           ^
packs to the left----------|

还是我误解了你的意思?

那是很多代码,其中很多与tkinter无关。你能试着最小化代码以便于帮助你吗:)对不起,读者,我在post上编辑了我的代码,我认为应该改为
self.canvas.config(scrollregion=self.interior.bbox('all'))
应该是
self.canvas.config(scrollregion=self.canvas.bbox('all'))
。这些标签上方的空间(蓝色区域)是因为滚动区域小于可视区域。如果你