小编use*_*539的帖子

需要显示在3行而不是1行

我想要的结果是有一个python窗口,其中两个按钮"显示信息""退出"彼此相邻,并让"显示信息"按钮在3个单独的行上显示我的姓名和地址,然后在"退出"时停止程序点击.我几乎就在那里 - 文字虽然在一条线上.

提前致谢.

# This program will demonstrate a button widget within a dialog box
# that shows my information.

# Call TK interface
import tkinter
# Call message box
import tkinter.messagebox

# Create class for GUI.


class MyGUI:
    def __init__(self):
        #Create the main window widget.
        self.main_window = tkinter.Tk()

        #Create button widget 1.
        self.my_button = tkinter.Button(self.main_window, \
                                        text='Show Info', \
                                        command=self.show_info)

        #Creat a quit button.
        self.quit_button = tkinter.Button(self.main_window, \
                                          text='Quit', \
                                          command=self.main_window.destroy)

        # Pack the buttons.
        self.my_button.pack(side='left')
        self.quit_button.pack(side='left')

        #Enter …
Run Code Online (Sandbox Code Playgroud)

python tkinter

2
推荐指数
2
解决办法
5845
查看次数

标签 统计

python ×1

tkinter ×1