Skip to content

Interface😆

The class show the images detected in Detection class. Also, provide the function to upload the image to Google Cloud Storage.

Link to the class

Attributes😆

Attributes Type Description
root tkinter.Tk Root object from tkinter.
frame numpy.array Image with bounding box and categories.

Constructor😆

__init__(self, cfg: str = "cfg.yml")😆

  • Args
    • cfg: Path to the yaml file. The parameters of the cfg file are listed here.

Method😆

start(self)😆

Start the tkinter to work. The code inside is simply self.root.mainloop()

extra_info(self, info: dict)😆

Show the user-defined information. The layout and the composition will be rearranged.

Example😆

import gcdetection

# Create detection interface and start detecting
detect_window = gcdetection.Interface()
detect_window.start()

For more example, please visit the example repository.

Extensive usage.😆

User can access to the root attribute. Any method that can be used in tkinter can also be implemented here. Below are some examples that users can do.

  • Key binding

    Documentation from tkinter

    import gcdetection
    ...
    detect_window = gcdetection.Interface()
    
    # Should specify the event arguments for tkinter to pass in
    def task(event):
        pass
    # Bind key "k" to function "task"
    detect_window.root.bind("k", task)
    ...
    
  • Continuing task

    Reference to the usage

    import gcdetection
    ...
    detect_window = gcdetection.Interface()
    ...
    # Should specify the event arguments for tkinter to pass in
    def task(event):
        # TODO: Task to define
        detect_window.root.after(20, task)
    
    # Run the task every 20 milliseconds
    detect_window.root.after(20, task)
    # Bind key "k" to function "task"
    detect_window.root.bind("k", task)
    ...