Python Forum
Drawing a sine curve in memory view of Task Manager
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Drawing a sine curve in memory view of Task Manager
#1
Question 
Hi guys [Image: icon_e_smile.gif]

I am trying to write a simple proof-of-concept script on Windows 10 that let's me draw the absolute of a sin curve in the task manager memory window.

My code is as follows:

import time
import math
import gc
import sys

x = 1
string_drawer = []

while True:

    #Formula for the eqaution (sin curve)
    y = (abs(math.sin(math.radians(100*x))))*512000000
    print (y, type(y))

    #Making y type 'int' so that it can be used to append
    y = int(round(y))
    print (y, type(y))

    #Checking the size of string_drawer for debugging
    print(sys.getsizeof(string_drawer))

    #Loop used for appending
    if sys.getsizeof(string_drawer) < y: #If y is bigger, find the difference and append

        y = y - sys.getsizeof(string_drawer)
        string_drawer.append(' ' *y)

    elif sys.getsizeof(string_drawer) > y: #If y is smaller, delete the variable and make a new one

        string_drawer = [] *y

    else: #If y is the same size as string_drawer, do nothing

        pass

    #Call the Python gerbage colector
    gc.collect()

    #Sleep to make sure Task Manager catches the change in RAM usage
    time.sleep(0.5)

    #Increment x
    x += 1
    print(x, type(x))
What I am getting is this:
[Image: ahEsx.png]

What I want is this:
[Image: UXPYc.png]

I am not entirely sure what I am doing wrong, but I suspect it is something to do with the garbage collection in Python. I've extensively searched for the answer, but I didn't find anything that worked...

I hope you guys can help me. Thanks!
Reply


Messages In This Thread
Drawing a sine curve in memory view of Task Manager - by Lukiewookie - Sep-19-2016, 11:23 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Learning curve astral_travel 3 555 Apr-05-2024, 06:58 PM
Last Post: jefsummers
  How can I design shapes on a curve in python? mervea 2 901 Sep-14-2023, 01:04 PM
Last Post: Pedroski55
  Fitting data to a curve daaegp 1 682 Jun-30-2023, 08:06 PM
Last Post: Gribouillis
  count certain task in task manager[solved] kucingkembar 2 1,214 Aug-29-2022, 05:57 PM
Last Post: kucingkembar
  Find factor to match test curve to golden curve SriRajesh 0 1,614 Jun-17-2021, 04:39 AM
Last Post: SriRajesh
  Fitting Gaussian curve to data file Laplace12 0 2,853 Jun-09-2021, 10:45 AM
Last Post: Laplace12
  Schedule a task and render/ use the result of the task in any given time klllmmm 2 2,192 May-04-2021, 10:17 AM
Last Post: klllmmm
  How to create a task/import a task(task scheduler) using python Tyrel 7 3,938 Feb-11-2021, 11:45 AM
Last Post: Tyrel
  search of a curve fitting function bluffy5 2 2,511 Dec-13-2020, 09:53 AM
Last Post: ndc85430
  How to create an app manager _ShevaKadu 8 3,938 Nov-01-2020, 12:47 PM
Last Post: _ShevaKadu

Forum Jump:

User Panel Messages

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