Python Forum
[Tkinter] Defining a self made module's function to interact with the main .py variables?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Defining a self made module's function to interact with the main .py variables?
#7
Ok this is too complicated for my current level i'm afraid.
I compermised on just reading from the complete .txt file that contains the output
and display it in the text widget when its done but I got lost trying to refresh with the after() func.
what it does is actually freeze the textbox (and the program) for the amount of ms I set...

how can I make the text window read the file after every time I click submit?

    self.text_widget()

    def text_widget(self):

        self.text_file = open(fr'c:/users/{os.getlogin()}/Desktop/default.txt', 'w+').read()
        self.text_window = tk.Text(self, height=100, width=500, bg="gray", wrap=tk.WORD)
        self.text_window.update()
        self.text_window.grid(row=7, column=1, rowspan=3, sticky="we")
        self.text_window.insert(tk.END, self.read_file)
        self.text_window.after(5000, self.read_file)

    def read_file(self):
        self.text_file = open(fr'c:/users/{os.getlogin()}/Desktop/default.txt', 'w+').read()
        self.text_window.insert(tk.END, self.text_file)
Reply


Messages In This Thread
RE: How can I define a selfmade module's functio to interact with the main .py variables? - by Gilush - Jun-08-2020, 12:10 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I run an interface I made using PyQt5 and a Map program I made using Tkinter bki 6 1,442 Nov-09-2023, 11:12 PM
Last Post: bki
  [PyQt] Managing variables accross a multiple module GUI Oolongtea 18 11,228 Sep-19-2019, 12:13 PM
Last Post: Oolongtea
  “main thread is not in main loop” in Tkinter Long_r 1 24,598 Jun-26-2019, 11:00 PM
Last Post: metulburr
  [Tkinter] Bringing function out of class into main loop zukochew 1 2,737 Jul-30-2018, 06:43 PM
Last Post: Axel_Erfurt
  GTK main window calling a main window DennisT 4 7,057 Oct-19-2016, 09:36 PM
Last Post: DennisT

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020