Skip to main content

ctkchart is a Python library for creating live updating line charts in customtkinter.

Project description

ctkchart

Downloads Downloads Downloads

  • ctkchart is a python library for creating live updating line charts in customtkinter.

  • Features

    • Live Update: Display live data with line charts.
    • Multiple Lines: Support for plotting multiple lines on the same chart for easy comparison.
    • Color Customization: Customize colors to match your application's design or data representation.
    • Dynamic Color Change: Dynamic Color Change for Dark & Light.
    • Font Customization: Adjust fonts for text elements to enhance readability.
    • Dimension Customization: Customize chart dimensions to fit various display sizes and layouts.

    Importing & Installation

    • Installation

      pip install ctkchart
      
    • Importing

      import ctkchart
      

    Simple Guide

    • import package

      import ctkchart
      
    • Create Line Chart and place the chart

      chart = ctkchart.CTkLineChart(
          master=root,
          x_axis_values=("a", "b", "c", "d", "e", "f"),
          y_axis_values=(100, 900)
      )
      chart.place(x=10, y=10)
      
    • Create Line

      line = ctkchart.CTkLine(master=chart)
      
    • Display Data display data using a loop

      def loop():
          while True:
              random_data = random.choice(range(100, 900))
              chart.show_data(line=line, data=[random_data])
              time.sleep(1)
      
      #call the loop as thead
      theading.Thread(target=loop).start()
      

    Full Code Example

    import ctkchart #  <- import the package
    import tkinter
    import random
    import threading
    import time
    
    #create window
    root = tkinter.Tk()
    
    #create chart
    chart = ctkchart.CTkLineChart(
        master=root,
        x_axis_values=("a", "b", "c", "d", "e", "f"),
        y_axis_values=(100, 900)
    )
    chart.place(x=10, y=10) #place chrt
    
    #create line
    line = ctkchart.CTkLine(master=chart)
    
    def loop():
        while True:
            random_data = random.choice(range(100, 900)) #get random data
            chart.show_data(line=line, data=[random_data]) # <- display data using chart 
            time.sleep(1) #wait 1 sec
            
    #call the loop as thead
    threading.Thread(target=loop).start()
    
    root.mainloop()
    

    Links


    Contributors

    Project details


    Download files

    Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

    Source Distribution

    ctkchart-2.1.3.tar.gz (25.7 kB view details)

    Uploaded Source

    Built Distribution

    ctkchart-2.1.3-py3-none-any.whl (25.3 kB view details)

    Uploaded Python 3

    File details

    Details for the file ctkchart-2.1.3.tar.gz.

    File metadata

    • Download URL: ctkchart-2.1.3.tar.gz
    • Upload date:
    • Size: 25.7 kB
    • Tags: Source
    • Uploaded using Trusted Publishing? No
    • Uploaded via: twine/5.0.0 CPython/3.12.1

    File hashes

    Hashes for ctkchart-2.1.3.tar.gz
    Algorithm Hash digest
    SHA256 dfe9553807e073370e15620b37ecffaef41df884cc32e72d643768d6ca7fa5ea
    MD5 4c3b89018e9fbf1e9e968fa16fc6b4ca
    BLAKE2b-256 e7c3c98f1a64317e088d63d281a3d0043d5473c3465a181f3c6224a0b2d9592c

    See more details on using hashes here.

    File details

    Details for the file ctkchart-2.1.3-py3-none-any.whl.

    File metadata

    • Download URL: ctkchart-2.1.3-py3-none-any.whl
    • Upload date:
    • Size: 25.3 kB
    • Tags: Python 3
    • Uploaded using Trusted Publishing? No
    • Uploaded via: twine/5.0.0 CPython/3.12.1

    File hashes

    Hashes for ctkchart-2.1.3-py3-none-any.whl
    Algorithm Hash digest
    SHA256 47b7b4303fc8b80add04dcf22b44690e45394a350f9923bc571550d8e197ce1c
    MD5 38cf65dbeee5b6396e0dc2f3bb622f0a
    BLAKE2b-256 e4920b76a03a718929cdf264bb613abaeb20019b383ceb62670b21567313a6bb

    See more details on using hashes here.

    Supported by

    AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page