Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

tkinter Error/ insert text from another function help

this is the code guys just tryna make the update text function work the error i get is "AttributeError: 'App' object has no attribute 'textbox'


Code
import os
import requests
import json
import hashlib
import time

from tkinter import *
from tkinter import ttk
import threading


class App(threading.Thread):

   def __init__(self):
       threading.Thread.__init__(self)
       self.start()

   def callback(self):
       self.root.quit()

   def run(self):
       self.root = Tk()
       self.root.geometry('500x300')
       title = Label(self.root, text='H0lyAV v0.1')
       title.pack()
       tabocontrol = ttk.Notebook(self.root)
       tab1 = ttk.Frame(tabocontrol)
       tab2 = ttk.Frame(tabocontrol)
       tabocontrol.add(tab1, text='Main')
       tabocontrol.add(tab2, text='Settings')
       self.textbox = Text(tab1, height=10, width=100)
       self.textbox.pack(side=BOTTOM)
       self.text = Text(self.textbox)
       b1 = Button(tab1, text='asdf')
       b1.pack(anchor='w')
       self.root.protocol("WM_DELETE_WINDOW", self.callback)
       tabocontrol.pack(expand=1, fill="both")
       self.root.mainloop()

   def updatetext(self):
       self.textbox.insert(INSERT, 'ASDF')

if __name__ == '__main__':
   App = App()
   App.updatetext()
Nothing ever calls App.run, thus, self.textbox isn't initialized.

Je t'aime
[Image: fpZ5a5g.png]

(Apr 22, 2022 04:39 PM)-Scrub Wrote:  Jokes on you, I'm not smart enough to know what he's talking about.
(Dec 11, 2019 09:18 AM)Nachfolger Wrote:  Nothing ever calls App.run, thus, self.textbox isn't initialized.

how would you fix this bro? if i call app.run the gui starts acting funky.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by MiguelSanchezApr 12, 2022 02:13 PM 1 159 Apr 12, 2022 02:13 PM
Last Post: lightduty
[C] by FhackMar 2, 2022 03:52 AM 4 307 Mar 2, 2022 03:52 AM
Last Post: Fhack
[Python] by RevNucleusJul 24, 2021 10:40 PM 2 154 Jul 24, 2021 10:40 PM
Last Post: RevNucleus