Giter Club home page Giter Club logo

tk_tools's Introduction

Build Status

Documentation Status

Purpose

This repository holds useful high-level widgets written in pure python.
This library used type hints and requires Python 3.5+; it could, however, be back-ported to earlier Python versions without difficulty.

For more details, check out the documentation.

Here are some examples screenshots of the widgets you can create:

Button-Grid:

Button-Grid

Binary-Label:

Byte-Label

Calendar:

Calendar

Entry-Grid:

Entry-Grid

Multi-Slot Frame

Multi-Slot Frame

Graph:

Graph

Key-Value:

Key-Value

Label-Grid:

Label-Grid

LED: (size can be scaled)

LED

SevenSegment and SevenSegmentDisplay

Seven Segment Display

Gauge

Gauge

Gauge Documentation

Rotary-Scale: (Tachometer)

Rotary-Scale

Dependencies

This package is dependant on engineering_notation, which is one of my other packages.

Testing

Basic testing has been instantiated however it is currently limited. To execute style testing:

flake8 tk_tools

To execute automated tests:

py.test test.py

More testing will be added to new widgets as they are brought online while further testing will be added to old widgets as the project matures.

Contributions

Contributions for new widgets, documentation, tests, and resolving issues are welcomed.

Contribution guidelines:

  1. Fork the repository to your account.
  2. Clone your account repository to your local development environment.
  3. Create/checkout a new branch appropriately named by feature, bug, issue number, whatever.
  4. Make your changes on your branch. The ideal changes would:
  • have working examples in the examples directory
  • have documentation in the docs directory
  1. Push your changes to your github account.
  2. Create a pull request from within github.

All code is to be passing flake8 before it is merged into master!

tk_tools's People

Contributors

aokiahishatsu avatar naejgz avatar reblochonmasque avatar slightlynybbled avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tk_tools's Issues

Some remarks on the behavior of some of the widgets

Following are notes of my first impressions when running the examples provided; this is not saying that the behavior of the widgets should be changed; it is more to open a discussion, because the object behavior differed from my intuitive expectation.

EntryGrid & LabelGrid:

Should probably be able to choose which row to delete.
adding/deleting a row would be better if it did not move the buttons --> maybe place them on top & set the width?

Graph:

Should probably be resizable with the window, by default

Led:

Maybe a click on the LED should toggle the on/off?
...or maybe not?
In the examples: led.to_grey does not accept an argument; this is inconsistent with the other colors. Maybe it should take an arg, but ignore it?

RotaryScale:

In the examples, the increments go over 100 while neither the display nor the gauge do.
That is, after clicking over 100, reversing of the dial, and values, are lagging when pressing decrement.
The same is true at the other end of the scale.
It seemed a bit odd.

Cheers.
Fred

Calendar translations

Hi,
is it possible to translate in different languages the Calendar widget? For exxample, months and days, that are displayed in the Calendar.
Thanks

Guage border

Hello, i am having trouble to remove white border around the gauges.
I try what i found on the internet but it doesn't help.
Screenshot from 2021-03-08 10-08-35

Row title

Hi,
is it possible to add text as first element in table?
Thanks

Change the frame backgrounf color of the LED widget.

Is there a way to change the background color of the frame in the LED widget?
Its always a white square with the led in the center. Typical frame color options error out such as bg='grey' or background='grey'
in the docs it says **options "The frame options". What exactly are the frame options?

Thank you.

Not able to set the fonts

There is no way to change the fonts.

    helv36 = font.Font(family='Helvetica', size=12, weight='bold')
    self.driver = tk_tools.KeyValueEntry(
        root,
        width=guage_width,font=helv36,
        title='Driver',
        keys=['Name', 'Id', 'Trips'],
        enables=[False, False,False] 
         )

fails with

File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tk_tools/groups.py", line 308, in init
super().init(self._parent, borderwidth=2,
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tkinter/ttk.py", line 740, in init
Widget.init(self, master, "ttk::frame", kw)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tkinter/ttk.py", line 557, in init
tkinter.Widget.init(self, master, widgetname, kw=kw)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tkinter/init.py", line 2567, in init
self.tk.call(
_tkinter.TclError: unknown option "-font"

disable smart option menu?

I am using tk-tools for first time and I am trying to temporarily
disable the smart option menu and re-enable later.

I used this I found in the docs:

tk_tools.enable=False

which doesn't seem to work, I can find no way
of refreshing the widget either,

working on the assigned name of the widget (drop_down in my case)
doesn't work either, causes an error.

Any ideas?

Is there any way to change the settings for the gauge without destroying and calling it again?

I am trying to dynamically change the gauge parameters for min/max value and update the value for the gauge but cannot figure out how to do this. Is it possible with this module?

from tkinter import *
import tk_tools
from time import sleep

root = Tk()


gauge = tk_tools.Gauge(root, 
                       min_value=20.0,
                       max_value=65.0,
                       divisions=int((65-20)/5),
                       red_low=25,
                       yellow_low=35,
                       yellow=55,
                       red=60,
                      )
                       
gauge.set_value(10)
gauge.pack()
i=20

loop = True
while loop:
    try:     
        gauge.update()

        if i < 25:
            gauge.pack_forget()
            gauge = tk_tools.Gauge(root, 
                       min_value=i,
                       max_value=65.0,
                       divisions=int((65-20)/5),
                       red_low=25,
                       yellow_low=35,
                       yellow=55,
                       red=60,
                      )
            gauge.pack()
            
        gauge.set_value(i)
        gauge.pack()
        i+= 1
        if i>25:
            i = 20
        sleep(0.1)	
    except KeyboardInterrupt:
        root.quit()
        loop = False    

''

RotaryScale blinks on high refresh rate

Check this out:

import tkinter as tk
import tk_tools
import threading, random, time


class Runner(threading.Thread):
	def __init__(self, rscale, pause):
		threading.Thread.__init__(self)
		self.rscale = rscale
		self.pause = pause

	def run(self):
		while True:
			self.rscale.set_value(random.randint(0, 101))
			time.sleep(self.pause)


root = tk.Tk()
rs = tk_tools.RotaryScale(root, max_value=100.0, size=100, unit='km/h')
rs.grid(row=0, column=0)

Runner(rs, 0.02).start()

root.mainloop()

If increase the pause to 0.1 it's fine, but what is causing this in first place?

Set the initial date.

I read the documentation several times but I did not find a attribute to set the initial day of the calendar when it pop up. ¿Is there anyway to do that? If not, I think its a good point to improve. This project is wonderful, congrats.

create transparent Gauge

how can i create a transparent Gauge? (on a canvas), also is it possible to change the standart image?

LED widget refinement

Add on_click toggle functionality with the possibility for callbacks.

For instance, when user clicks an led that is red and off, then the LED turns on and calls any associated on callback.

Gauge not correctly updated

if I update the e.g. min_value after creation the middle value above the gauge is not updated.
Is there a solution for this?
See example script/images

testscripts.zip

Thanks for any help

Gauge2

Hello I've done this for my students
please see: https://github.com/naejgz/tk-tools
but I don't know how to ask for a pull request

Gauge2 : modifications from Gauge
************************
3 numeric values added : min, center, max,
and meter a bit flatter to accept center value
small correction of the rate for green yellow red zones
now 80% gives 2 red among 10 divisions
now yellow and red zone size can change
yellow and red zone also for too small values
readout still active with RED BG if values OFF limits
suppressed (commented) : create second half part
suppressed integer conversion on extend to not accumulate decimal loss errors
idem on value
math correction now min_value can be different from 0 or negative

spreadsheet_handle.py still in examples/

The example spreadsheet_handle.py has not been removed from the examples after SpreadSheetReader was removed from the package. So when trying to run it we get the error

Traceback (most recent call last):
  File "spreadsheet_handle.py", line 9, in <module>
    sheet_handle = tk_tools.SpreadSheetReader(root,
AttributeError: module 'tk_tools' has no attribute 'SpreadSheetReader'

Issues installing can amyone help

Might be a simle fix but i've only just stated to use Python/ Pi

pi@raspberrypi:~ $ sudo pip install https://github.com/slightlynybbled/tk_tools.git
Collecting https://github.com/slightlynybbled/tk_tools.git
Downloading https://github.com/slightlynybbled/tk_tools.git
/ 81kB 461kB/s
Cannot unpack file /tmp/pip-RVSs3O-unpack/tk_tools.git (downloaded from /tmp/pip-II44TN-build, content-type: text/html; charset=utf-8); cannot detect archive format
Cannot determine archive format of /tmp/pip-II44TN-build

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.