Re: Help with two issues, buttons and second class object

2016-11-25 Thread Peter Otten
Thomas Grops via Python-list wrote: > Also I am struggling to understand: > >def move_tank(self, dx, dy): > self.x += dx > self.y += dy > self.canvas.move(self.id, dx, dy) > > Where does the dx and dy values get input? To find the place where the move_tank() method

Re: Help with two issues, buttons and second class object

2016-11-25 Thread Peter Otten
Thomas Grops via Python-list wrote: > Peter, in your code what does that self.root = root mean in the __init__ > function of the class In your original script you used global variables to access the tkinter.Tk() object and the canvas. A simplified example: import tkinter class Tank: def

Re: Help with two issues, buttons and second class object

2016-11-25 Thread Thomas Grops via Python-list
Also I am struggling to understand: def move_tank(self, dx, dy): self.x += dx self.y += dy self.canvas.move(self.id, dx, dy) Where does the dx and dy values get input? -- https://mail.python.org/mailman/listinfo/python-list

Re: Help with two issues, buttons and second class object

2016-11-25 Thread Thomas Grops via Python-list
Peter, in your code what does that self.root = root mean in the __init__ function of the class -- https://mail.python.org/mailman/listinfo/python-list

Re: Help with two issues, buttons and second class object

2016-11-24 Thread Larry Hudson via Python-list
On 11/24/2016 06:53 AM, Peter Otten wrote: Thomas Grops via Python-list wrote: [snip...] Instead of repeating your code with copy-and-past make a helper function like the randx() posted by Larry Hudson. By the way, randint(min, max) may return max so there are 9 possible outcomes while you

Re: Help with two issues, buttons and second class object

2016-11-24 Thread Thomas Grops via Python-list
Wow thankyou that code is really good, I had no programming knowledge until 2 months ago, I enjoy your descriptions it is really helpful for me. I like to understand what the code does before using it myself or a variant of it. Will tweak bits tonight the project is in tomorrow. This code is

Re: Help with two issues, buttons and second class object

2016-11-24 Thread Peter Otten
Thomas Grops via Python-list wrote: > Hi I have created some code, which moves a rectangle around and when it > hits the edge it picks a random new direction. It does this by the count > function within my class. I am wanting to create a button to randomly > change count but I my class seems to

Help with two issues, buttons and second class object

2016-11-24 Thread Thomas Grops via Python-list
Hi I have created some code, which moves a rectangle around and when it hits the edge it picks a random new direction. It does this by the count function within my class. I am wanting to create a button to randomly change count but I my class seems to be getting errors. I also wanted to create