Python how to show text in a tkinter application on a none-button -


i'm extremely new python , has started small project learn stuff. anyways, says in title, how show text in tkinter application without creating buttons? here's code if need it

import tkinter tk ulo = 1 hoho = 0 def lul():     global ulo     #ulo = ulo + 1     global  hoho     hoho = hoho + ulo     print(hoho) class application(tk.frame):      def __init__(self, master=none):         tk.frame.__init__(self, master)         self.pack()         self.createwidgets()       def createwidgets(self):         self.hi_there = tk.button(self, fg="green")         self.hi_there["text"] = "pressing buttons fun,\n isn't it?"         self.hi_there["command"] = self.lel         self.hi_there.pack(side="top")     def lel(self):         lul() root = tk.tk() app = application(master=root) app.mainloop() 

there couple options using labels fitting 1 since label's job showing text/image.

the label widget standard tkinter widget used display text or image on screen. label can display text in single font, text may span more 1 line.

def createwidgets(self):     self.lbl = tk.label(self, text="pressing buttons fun, isn't it?")     self.hi_there = tk.button(self, fg="green")     self.hi_there["text"] = "let's press"     self.hi_there["command"] = self.lel      self.lbl.pack()     self.hi_there.pack(side="top") 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

android - CoordinatorLayout, FAB and container layout conflict -