Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/294.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 使用tkinter在GUI中创建一个框_Python_Python 3.x_User Interface_Tkinter - Fatal编程技术网

Python 使用tkinter在GUI中创建一个框

Python 使用tkinter在GUI中创建一个框,python,python-3.x,user-interface,tkinter,Python,Python 3.x,User Interface,Tkinter,我的GUI当前如下所示: 我想做的是让它看起来更好。通过创建两个框,一个用于个人详细信息,另一个用于预订信息 最好的方法是什么?我尝试过使用画布,但这不起作用,因为我正在使用网格来显示文本和按钮。实现这一点的典型方法是使用画布。为每个部分创建一个,并在每个框架中放置适当的小部件。这正是Frame和LabelFrame存在的原因——提供了一种将小部件组织到逻辑组中的方法 例如: customer_frame = tk.LabelFrame(parent, text="Customer Deta

我的GUI当前如下所示:

我想做的是让它看起来更好。通过创建两个框,一个用于个人详细信息,另一个用于预订信息


最好的方法是什么?我尝试过使用画布,但这不起作用,因为我正在使用网格来显示文本和按钮。

实现这一点的典型方法是使用画布。为每个部分创建一个,并在每个框架中放置适当的小部件。这正是
Frame
LabelFrame
存在的原因——提供了一种将小部件组织到逻辑组中的方法

例如:

customer_frame = tk.LabelFrame(parent, text="Customer Details", pady=20)
booking_frame = tk.LabelFrame(parent, text="Booking Details", pady=20)
...

# customer inputs
first_label = tk.Label(customer_frame, text="First Name:")
first_entry = tk.Entry(customer_frame)
...

# booking inputs
first_label = tk.Label(booking_frame, text="First Name:")
first_entry = tk.Entry(booking_frame)
...

网格的使用与能否使用画布无关。尽管如此,画布不太可能是这项工作的合适工具。