Display and play audio files

2024/9/20 8:01:35

I am new to python, and I'm trying to build a simple recording program. With the some help from my previous question, I was able to add a timestamp for each recorded file

EDIT:

I did some research and decided on displaying the files with filechooser... this still does not work

def openfiles(self, *args):satter2 = BoxLayout(pos= (629, 950), size_hint= (.1,.1))self.fclv = FileChooserListView(path= '/sdcard/', filters= [‘*.3gp’])self.fclv.bind(on_selection= self.pressed(fclv.selection)scatter.add_widget(self.fclv)self.add_widget(satter2)def pressed(self, filename):#with open(os.path.join(path, filename[0])) if self.soundf is None:self.soundf = SoundLoader.load(self.path)if self.soundf.status != 'stop':self.soundf.stop()self.soundf.loop = Falseself.soundf.play()
Answer

Here is a simple example of how to show all 3gp files in your current directory.

from kivy.app import App
from kivy.uix.filechooser import FileChooserListView
from kivy.uix.boxlayout import BoxLayoutclass MyLayout(BoxLayout):def __init__(self,**kwargs):super(MyLayout,self).__init__(**kwargs)self.fclv = FileChooserListView(path= '.', filters= ['*.3gp'])self.add_widget(self.fclv)class MyApp(App):def build(self):return MyLayout()MyApp().run()

Result is:

Files in a ListView

https://en.xdnf.cn/q/119782.html

Related Q&A

Web Scraping BeautifulSoup - Next Page parsing

Im just learning web scraping & want to output the result of this website to a csv file https://www.avbuyer.com/aircraft/private-jets but am struggling with parsing the next pages here is my code (…

convert sum value to percentage by userid django

Im trying to convert the total sum to a percentage by userid but an error pops up when I try to run the following program. The error is: name mark is not definedBelow is my code for views.pydef attStud…

ValueError: Too many values to unpack

Task is to find,sort,and remove the student with type: "homework" and with the lowest score using MongoDB. I also tried to use toArray() function,but it gave an error. Now I try to move on in…

Pandas - Create dynamic column(s) from a single columns values

I have JSON data which I am planning after converting it to desired dataframe, will concat with another dataframe. Participant**row 1** [{roles: [{type: director}, {type: founder}, {type: owner}, {type…

How to automatically remove certain preprocessors directives and comments from a C header-file?

Whats a good way to remove all text from a file which lies between /* */ and #if 0 and corresponding #endif? I want to strip these parts from C headers. This is the code I have so far:For line in file…

Get all pairs from elements in sublists

I have a list of sublists. I need all possible pairs between the elements in the sublists. For example, for a list like this: a=[[1,2,3],[4,5],[6]]The result should be: result=[[1,4], [1,5], [1,6], [2,…

Extracting variables from Javascript inside HTML

I need all the lines which contains the text .mp4. The Html file has no tag!My code:import urllib.request import demjson url = (https://myurl) content = urllib.request.urlopen(url).read()<script typ…

Pygame, self is not defined [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.This question was caused by a typo or a problem that can no longer be reproduced. While similar q…

Python 3- assigns grades [duplicate]

This question already has answers here:Python 3- Assign grade(2 answers)Closed 8 years ago.• Define a function to prompt the user to enter valid scores until they enter a sentinel value -999. Have …

how to read video data from memory use pyqt5

i have an encrypted video file, i want to decrypt this file into memory and then use this data play video. but qt mediaplayer class is to pass a file name in, i need to have any good way?this is my co…