Skip to main content

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

Project description

Chinese

ctkchart

ctkchart

v 2.1.9

Downloads Downloads last 6 month Downloads Downloads

PyPI - License LOC

  • 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.

    Check out what's new | Changes


    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.9.tar.gz (29.9 kB view details)

    Uploaded Source

    Built Distribution

    If you're not sure about the file name format, learn more about wheel file names.

    ctkchart-2.1.9-py3-none-any.whl (29.5 kB view details)

    Uploaded Python 3

    File details

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

    File metadata

    • Download URL: ctkchart-2.1.9.tar.gz
    • Upload date:
    • Size: 29.9 kB
    • Tags: Source
    • Uploaded using Trusted Publishing? No
    • Uploaded via: twine/6.1.0 CPython/3.12.6

    File hashes

    Hashes for ctkchart-2.1.9.tar.gz
    Algorithm Hash digest
    SHA256 2ac1d256219d7ef375bd73bfe200c4dad12d42737cfd6b09f594c26cbfe341a0
    MD5 c8cf7923975189653c79814a3ddced38
    BLAKE2b-256 caca09c8e85487b2383c0359e41f7651375ab9c0e0799da3cda7698b29bb6981

    See more details on using hashes here.

    File details

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

    File metadata

    • Download URL: ctkchart-2.1.9-py3-none-any.whl
    • Upload date:
    • Size: 29.5 kB
    • Tags: Python 3
    • Uploaded using Trusted Publishing? No
    • Uploaded via: twine/6.1.0 CPython/3.12.6

    File hashes

    Hashes for ctkchart-2.1.9-py3-none-any.whl
    Algorithm Hash digest
    SHA256 d20418572a189a3458a25c4599832512206e93ec0c8cdaf13faedc3f462480e9
    MD5 54e4d53b13a1995c72336f6812fe5ebb
    BLAKE2b-256 72b610b7c52db651d9bdfefb740f022cd397083630053ae8037747a0d7d2829b

    See more details on using hashes here.

    Supported by

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