Q:

how can i randomise the location of a widget on a window to make it different every time

i am trying to make a button widget that is created in a random position and everytime i click it it moves to another random position.
i have tried using the random function in the pack() parenthesis:
w= tkinter.Tk()
w.configure(background= 'steelblue1')
mb= tkinter.Button(w, text= 'o_o')
mb.pack(random)

w.mainloop()

i didn't expect this to work but was just trying it out, and this resulted in:
    object of type 'module' has no len()
what would the len() be and how do i correctly use random?

A:

To place a button relative to the window you should use place(). 
mb.place(x=horizontal_pos, y=vertical_pos)

You can do it with pack also but then you would have to generate random padding instead. 
Generate random integers with the random.uniform() function. see examples of usage in the random module.

