How do we dynamically change the text in label widget of Tkinter according to the change of subscribed topic message?

I wanted to change the text of my label according to the topic message to which my node subscribes. But the problem is that the text in the label is not changing with the change of topic message. A portion of my code is given below:(I used the code to dynamically change the text in the label from https://bytes.com/topic/python/answer... )

    v = StringVar()
v.set(distance)
self.clock = Label(frame, font=('times', 20, 'bold'), bg='green', textvariable = v)
self.clock.pack(fill=BOTH, expand=1)
rate = rospy.Rate(2)

while not rospy.is_shutdown():
rospy.Subscriber("distance", Float32, self.callback)
v.set(distance)
print("distance = %f", distance)