How can I create a simulation of block going up and down with respect to change in its density in a water tank by python?

I want to create a simulation using python and tkinter and simpy. According to Archimedes principle when the user varies the density of the block the block should move up and down. Please tell me how I can go about it !