私は非常にPythonには新しく、物事を学ぶための小さなプロジェクトを開始しました。とにかく、タイトルで言うように、ボタンを作成せずにテキストをtkinterアプリケーションに表示するにはどうすればいいですか?ラベルの仕事は、テキスト/画像を示しているので、あなたはそれがPythonなしボタンでtkinterアプリケーションにテキストを表示する方法
import tkinter as 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 is 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()
この質問はおそらく、すべてのTkinterのチュートリアルで覆われているだけでなく、ほとんどのtkinterのドキュメント。 –
@BryanOakleyすべてのtkinterチュートリアルは本当に不明で、古いPythonバージョンを使用するか、私の質問に答えがありません。だからこそ私がここに来たのです –