Python GUI programming

 

 2017.2.14 

       I haven't written code for a long time. I feel like I haven't done anything for a year. It seems that I have read C++. Suddenly I find that it is much easier to look at C++ now, and pointers are not so difficult. Then I just looked at the machine. Learning, it feels a little difficult, and now I find that many of them involve knowledge of advanced numbers, probability theory and linear algebra. I think that I learned these things in a mess. Then last time I chatted with Populus euphratica, he said that a lot of things are learned in practice.

       Well, continue my Python, Python's graphical interface programming.

import tkinter as tk

class APP:
    def __init__(self,master):
        frame = tk.Frame(master)
        frame.pack(side=tk.LEFT,padx=30,pady=10)

        self.hi_there = tk.Button(frame,text="打招呼",bg="black",fg="white",command=self.say_hi)
        self.hi_there.pack()#调整位置

    def say_hi(self):
        print("大家好!")
root = tk.Tk()
app=APP(root)
root.mainloop()

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326703788&siteId=291194637