Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

player.play() -> Attribute error #60

Open
AntonyKozm opened this issue Oct 30, 2024 · 1 comment
Open

player.play() -> Attribute error #60

AntonyKozm opened this issue Oct 30, 2024 · 1 comment

Comments

@AntonyKozm
Copy link

I have a problem. When I select an item in treeview I update the video path. It throws an error that the container is NoneType

Code:

    def _init_widgets(self):
        self.columnconfigure(0, weight=1)
        self.columnconfigure(1, weight=1, minsize=200)

        self.rowconfigure(0, weight=1)
        self.rowconfigure(1, minsize=20)

        columns = ("index", "name", "checked")

        self.treeview = ttk.Treeview(self, show="headings", columns=columns)

        self.treeview.heading("index", text="ID")
        self.treeview.heading("name", text="Name")
        self.treeview.heading("checked", text="Checked")

        self.scrollbar = ttk.Scrollbar(
            self, orient=VERTICAL, command=self.treeview.yview
        )

        self.treeview.config(yscroll=self.scrollbar.set)

        self.treeview.grid(column=0, row=0, sticky=NSEW)

        self.treeview.bind("<<TreeviewSelect>>", self.on_treeview_select)

        self.label = ttk.Label(self, textvariable=self._last_path)
        self.label.grid(row=1, sticky=NSEW)
        
        self.player = TkinterVideo(master=self, scaled=True, keep_aspect=True)
        self.player.grid(column=1, row=0, sticky=NSEW)

    def on_treeview_select(self, ev):
        video_item = self._get_video_item() # returns a tuple with index, video object and its state

        video: Video = video_item[1]

        self.player.load(video.local_path)

        self.player.play()

Traceback:

Exception in thread Thread-2 (_load):
Traceback (most recent call last):
  File "C:\Users\Antony\.pyenv\pyenv-win\versions\3.10.11\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "C:\Users\Antony\.pyenv\pyenv-win\versions\3.10.11\lib\threading.py", line 953, 
in run
    self._target(*self._args, **self._kwargs)
  File "d:\Files\Projects\Python\tiktok_automation\.venv\lib\site-packages\tkVideoPlayer\tkvideoplayer.py", line 201, in _load
    self._container.close()
AttributeError: 'NoneType' object has no attribute 'close'
@AntonyKozm AntonyKozm changed the title self._container.close() -> Attribute error player.play() -> Attribute error Oct 30, 2024
@PaulleDemon
Copy link
Owner

PaulleDemon commented Oct 30, 2024

Its a bug will fix it when I get time, until then use the work around mentioned here: #54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants