Python Forum

Full Version: Text after push button
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(Jul-05-2019, 02:11 PM)Yoriz Wrote: [ -> ]delayed_textok is a function not a method of master3
change
master3.after(1000,master3.delayed_textok)
to
master3.after(1000,delayed_textok)
new wrong:
master3.button['state'] = 'disabled'
AttributeError: 'Toplevel' object has no attribute 'button'

i am very despairing now.i dont know what to make.
The only button in the code shown is
b = button = tk.Button(master1,image=image2, height=80, width=160,background="red",font="0",bd=10,fg="black",command= text_1_2)
master3 has no button
(Jul-05-2019, 02:44 PM)Yoriz Wrote: [ -> ]The only button in the code shown is
b = button = tk.Button(master1,image=image2, height=80, width=160,background="red",font="0",bd=10,fg="black",command= text_1_2)
master3 has no button

thank you Yoriz,i delete the line with buttons and all is ok,i have only one wrong,:
"name finished is not defined"

this is a new kode,all work thanks to you,it nave only one error,: master3.after(1000,finished)
NameError: name 'finished' is not defined,
can you see the code,it have and another errors.

import tkinter as tk
from tkinter import *
import smtplib
from tkinter import Tk, Toplevel, Button
import RPi.GPIO as GPIO
import time
import tkinter.ttk as ttk
from tkinter.ttk import Progressbar, Style, Button
 
 
 
 
master= Tk()
 
master1 =Toplevel()
master3 =Toplevel()
 
 
##################################right
 
master1.minsize(150,150+170+170)
master1.geometry("185x1000+0+0")
master1.configure(background="black",)
master1.title("2")
master1.overrideredirect(True)
#################################left
 
 
master3.minsize(900,0+0+0)
master3.geometry("100x80+180+920")
master3.configure(background="red",)
master3.title("КАФЕ АВТОМАТ 1")
master3.overrideredirect(True)
#################################
 
 
master3.label = tk.Label(master3, text='this is OK')
master3.label.pack()
 
 
 
def text_1_2():
    b2()
    nadpisok()
   ##########################
 
     
def nadpisok():
    master3.label['text'] = 'please wait'
    master3.after(39000,delayed_textok)
    
     
def delayed_textok():
    master3.label['text'] = 'this is OK'
    master3.after(1000,finished)
 
      
 
 
###########################################
GPIO.setwarnings(False)
 
    
#########################################
def b2():
        GPIO.setmode(GPIO.BCM)
        RELAIS_2_GPIO = 10
        GPIO.setup(RELAIS_2_GPIO, GPIO.OUT)
        GPIO.output(RELAIS_2_GPIO, GPIO.HIGH)
        time.sleep(0.35)
        GPIO.output(RELAIS_2_GPIO, GPIO.LOW)
        time.sleep(0.35)
#########################################
 
 
image2 = tk.PhotoImage(file="")
b = button = tk.Button(master1,image=image2, height=80, width=160,background="red",font="0",bd=10,fg="black",command= text_1_2)
b.place(x = 0, y = 600)
label2=Label(master1,text="",height=0, width=0,bg="#100C19",font="Times 13 underline",fg="white",relief="solid",bd=0).place(x=0,y=200)
#########################
 
master.mainloop()
GPIO.cleanup()
There is no function finished either you need to define the function or put the correct function that should be called there
Pages: 1 2