-2

I have these functions in my python script the top three of them being related to tkinter and the bottom one being a process not related to the Tk window , how can i execute the pixels() function parallel to the tkinter functions ?

top.mainloop()
C.pack()
colors()
pixels()
  • use the threading module to start pixels in a seperate thread – Stack Jul 20 '17 at 11:33
  • 4
    Have you done *any* research on the topic? **If yes**, what are your findings? Refer to the articles you read, show what you have tried, explain what did not work. **If not**... why not? – Tomalak Jul 20 '17 at 11:34
  • https://stackoverflow.com/questions/18864859/python-executing-multiple-functions-simultaneously i tried this thread but due to having multiple functions both related and unrelated to each other I found myself conufsed with the way I am supposed to implement multiprocessing (i am quite new to python syntax and some stuff is a bit strange) – Noxid Jul 20 '17 at 11:39

1 Answers1

-2

Try tkinter's after method. Documentation here.

I see a lot of people who are looking for "running function along side tkinter mainloop" but cannot find after while researching. I guess it just isn't talked about much in documentation to show up on searches (besides SO questions).

Nelson
  • 922
  • 1
  • 9
  • 23
  • the function i try to run in parallel with the tkinter window is not related to the window and I need an endless loop to be running inside the pixels() function and that's thy after does not help me in this situation. – Noxid Jul 20 '17 at 12:06
  • `after` doesn't run code in parallel. Tkinter is single threaded, so it can only run one line of code at a time. – Bryan Oakley Jul 20 '17 at 12:09
  • @BryanOakley and here I am thinking `after` used a different thread. Thank you for telling me. – Nelson Jul 20 '17 at 12:21