Python Forum
Program to move a dot towards a circle center
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Program to move a dot towards a circle center
#5
(Nov-21-2021, 03:06 PM)BashBedlam Wrote: Here is a very basic script using pygame:

from pygame import display, QUIT, event, draw, time 
SCREEN = display.set_mode ((500, 500))

dot_x_position = 30
while True :
	for user_input_event in event.get () :
		if user_input_event.type ==  QUIT :
			exit ()
	SCREEN.fill ((0, 0, 0))
	draw.circle (SCREEN, (200, 0, 0), (249, 249), 220, 4)
	draw.circle (SCREEN, (0, 0, 200), (dot_x_position, 249), 20)
	if dot_x_position < 249 :
		dot_x_position += 1
	time.Clock ().tick (100)
	display.update ()

Many thanks! I have tried it and it is what I want to start with. I will add to it to do what I have in mind.

Much appreciated.
Reply


Messages In This Thread
RE: Program to move a dot towards a circle center - by plumberpy - Nov-23-2021, 10:49 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to plot seaborn heatmap on top of a background circle SriRajesh 0 1,451 Jul-09-2022, 04:00 AM
Last Post: SriRajesh
  (OpenCV) Help to improve code for object detection and finding center of it saoko 0 1,221 May-14-2022, 05:34 PM
Last Post: saoko
  [S0LVED] [Tkinter] Center dialog? Winfried 8 4,295 Mar-01-2022, 07:17 PM
Last Post: Winfried
  drawing moving circle on line with python barrai 1 3,185 Feb-25-2022, 03:33 PM
Last Post: BashBedlam
  Draw circle from GPS coords, and get GPX file? Winfried 0 2,204 Mar-29-2021, 07:19 PM
Last Post: Winfried
  Center align Kristenl2784 1 1,990 Aug-03-2020, 04:25 PM
Last Post: bowlofred
  Pyplot and circle Reldaing 0 1,508 Apr-01-2020, 10:44 AM
Last Post: Reldaing
  calculate circle sector Bloody_geek 2 2,324 Sep-11-2019, 08:54 PM
Last Post: Larz60+
  How can I move in an external program via Python? Pythoner 0 2,291 Dec-29-2018, 12:43 PM
Last Post: Pythoner
  Help with circle and motion wigigx 4 4,093 Aug-29-2017, 09:49 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

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