Python Forum
Partial using Tkinter function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Partial using Tkinter function
#1
Hi guys! I have this program which displays the time. The time is updated via a multiprocessing Process() which is targeted at a partial. However, the partial's function is supposed to set the value of a tkinter StringVar(). But, I get this error:

Error:
Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\joshu\AppData\Local\Programs\Python\Python38-32\lib\tkinter\__init__.py", line 1883, in __call__ return self.func(*args) File "C:/Users/joshu/Downloads/OrderLog.py", line 198, in sign_in_func main_app() File "C:/Users/joshu/Downloads/OrderLog.py", line 1074, in main_app time_process.start() File "C:\Users\joshu\AppData\Local\Programs\Python\Python38-32\lib\multiprocessing\process.py", line 121, in start self._popen = self._Popen(self) File "C:\Users\joshu\AppData\Local\Programs\Python\Python38-32\lib\multiprocessing\context.py", line 224, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "C:\Users\joshu\AppData\Local\Programs\Python\Python38-32\lib\multiprocessing\context.py", line 326, in _Popen return Popen(process_obj) File "C:\Users\joshu\AppData\Local\Programs\Python\Python38-32\lib\multiprocessing\popen_spawn_win32.py", line 93, in __init__ reduction.dump(process_obj, to_child) File "C:\Users\joshu\AppData\Local\Programs\Python\Python38-32\lib\multiprocessing\reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) TypeError: cannot pickle '_tkinter.tkapp' object
I'm using PyCharm as my editor.

The code:

now = datetime.datetime.now()

    time_var = StringVar()

    time_set_partial = partial(time_var.set, str(now.hour) + ":" + str("%02d" % now.minute).format(1))
    time_process = Process(target = time_set_partial)
    time_process.start()

    time_of_day = Label(textvariable = time_var)
    time_of_day.pack() 
I think the issue lies somewhere within the time_set_partial = partial(time_var.set, str(now.hour) + ":" + str("%02d" % now.minute).format(1)) line but I'm not sure.

I would be grateful if anyone can help : Smile.
Reply


Messages In This Thread
Partial using Tkinter function - by chesschaser - Jul-02-2020, 03:37 PM
RE: Partial using Tkinter function - by menator01 - Jul-02-2020, 05:06 PM
RE: Partial using Tkinter function - by chesschaser - Jul-02-2020, 05:34 PM
RE: Partial using Tkinter function - by menator01 - Jul-02-2020, 07:21 PM
RE: Partial using Tkinter function - by chesschaser - Jul-02-2020, 08:46 PM
RE: Partial using Tkinter function - by menator01 - Jul-02-2020, 09:15 PM
RE: Partial using Tkinter function - by chesschaser - Jul-03-2020, 10:31 AM
RE: Partial using Tkinter function - by menator01 - Jul-03-2020, 11:48 AM
RE: Partial using Tkinter function - by chesschaser - Jul-03-2020, 03:19 PM
RE: Partial using Tkinter function - by menator01 - Jul-03-2020, 03:37 PM
RE: Partial using Tkinter function - by chesschaser - Jul-03-2020, 03:57 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  partial functions before knowing the values mikisDeWitte 4 772 Dec-24-2023, 10:00 AM
Last Post: perfringo
  Move Files based on partial Match mohamedsalih12 2 1,001 Sep-20-2023, 07:38 PM
Last Post: snippsat
  Partial KEY search in dict klatlap 6 1,483 Mar-28-2023, 07:24 AM
Last Post: buran
  remove partial duplicates from csv ledgreve 0 925 Dec-12-2022, 04:21 PM
Last Post: ledgreve
  Webhook, post_data, GPIO partial changes DigitalID 2 1,148 Nov-10-2022, 09:50 PM
Last Post: deanhystad
  Optimal way to search partial correspondence in a large dict genny92c 0 1,069 Apr-22-2022, 10:20 AM
Last Post: genny92c
  Partial Matching Rows In Pandas DataFrame Query eddywinch82 1 2,488 Jul-08-2021, 06:32 PM
Last Post: eddywinch82
  Partial key lookup in dictionary GaryNR 1 3,625 Jul-16-2020, 06:55 PM
Last Post: Gribouillis
  Partial Word Search Kristenl2784 2 2,238 Jun-29-2020, 08:26 PM
Last Post: Kristenl2784
  Use a button in Tkinter to run a Python function Pedroski55 4 3,485 Jun-28-2020, 05:02 AM
Last Post: ndc85430

Forum Jump:

User Panel Messages

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