Example of Python GUI Programming Text Pop up Window

  • 2021-06-28 12:56:42
  • OfStack

As follows:


    out = subprocess.getstatusoutput('adb shell pm list packages')
 
    top = tk.Toplevel()
    top.title(' Package Name List ')
 
    top.geometry('%dx%d' % (400, 1200)) #  Set window size 
 
    t = Text(top, width=400, height=900)
    t.insert('1.0', "{}".format(out[1]))
    #  Insert text, quote it " 1.0 "   This is the coordinate of the inserted text, and 1 and 0 Between points, not commas, remember 
 
 
    # wraplength :   Start line break after specifying how many units 
    # justify:  Specify the alignment of multiple lines 
    #  Example:  Label(top, text=' View all package names on the current phone : ',wraplength = 80,justify = 'left').grid(row=1,stick=W, pady=10)
    t.pack()
    top.mainloop()

Related articles: