“Tkinter -Taste” Code-Antworten

So fügen Sie die Schaltfläche in TKinter hinzu

from tkinter import *
window = Tk()

def got_clicked():
  print("I got clicked!")

my_button = Button(text="Click me", command=got_clicked)
my_button.pack()

window.mainloop()
Tejas Naik

Funktion zu einer Taste in TKinter

from tkinter import *
#Creating a win
win = Tk()
#Giving a Function To The Button
def btn1():
  print("I Don't Know Your Name")
#Creating The Button
button1 =  Button(win, text="Click Me To Print SomeThing", command=btn1)
#put on screen
button1.pack()
win.mainloop()
#NB:This programme Will Print Something In The Terminal
#Check My Profile To See How We Print On The Screen Or Type In Google "Tkinter Label"
Hubert

So finden Sie den Text in der Schaltfläche in Tkinter

my_text = my_button.cget('text')
Coding Lemons

Tkinter -Taste

import Tkinter
import tkMessageBox

top = Tkinter.Tk()

def helloCallBack():
   tkMessageBox.showinfo( "Hello Python", "Hello World")

B = Tkinter.Button(top, text ="Hello", command = helloCallBack)

B.pack()
top.mainloop()
Zealous Zebra

Knöpfe auf Leinwand tkinter

# ... snip ...
button1 = Button(self, text = "Quit", command = self.quit, anchor = W)
button1.configure(width = 10, activebackground = "#33B5E5", relief = FLAT)
button1_window = canvas1.create_window(10, 10, anchor=NW, window=button1)
Muddy Magpie

Fügen Sie eine Taste auf TKinter hinzu

import tkinter
button1 = ttk.Button(self, text="anything", command=random command)
        button1.pack()
Super Starling

Ähnliche Antworten wie “Tkinter -Taste”

Fragen ähnlich wie “Tkinter -Taste”

Weitere verwandte Antworten zu “Tkinter -Taste” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen