Python代码:编写代码PEP8样式的最佳方法

时间:2019-05-30 19:36:11

标签: indentation python-3.7 pep8

对于下面的代码(缩进等),我找不到真正的最终答案。首先,我将所有参数放在一行上,然后我读到某个地方,每个参数都应放在单独的一行上。我真的应该把每个论点放在不同的地方吗?任何人都可以举例说明如何编写下面添加的代码(遵循PEP8指南)。

# Defining the buttons in the GUI.
        self.button_start = tk.Button(self.menu_frame,
                                      text="Start", height=5, width=20, fg="black",
                                      activeforeground="red", background="grey80", activebackground="grey80", command=self.start_button)
        self.button_stop = tk.Button(self.menu_frame,
                                     text="Stop", height=5, width=20, fg="black",
                                     activeforeground="red", background="grey80", activebackground="grey80", command=self.stop_button)
        self.button_iteration = tk.Button(self.menu_frame,
                                          text="Next iteration", height=5, width=20, fg="black",
                                          activeforeground="red", background="grey80", activebackground="grey80", command=self.create_next_gen)

0 个答案:

没有答案