Notifications
Clear all

eSpeak on a Raspberry Pi 4

116 Posts
9 Users
30 Likes
20.2 K Views
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
Topic starter  
Posted by: @triform

Yeah, the number is line.char_ndx

Yes, this is going to work out really well.  I'm able to put the text in from a list now, and get it back out of the textbox and put it back into a new list just the way I want it.

That line.char_ndx is a bit strange though.

When using the txtBox.get(index_start, index_end) I've discovered that it won't work for numbers like line.10, or line.20, etc.   Those look to the computer the same as line.1 and line.2.

So it seems that if I want to bring in 20 characters I need to use at least line.21.

But it also doesn't seem to matter if the ending index is greater than the text on a line.

In other words, if I use an index like line.41 and there are only say 15 characters of text on that line, then it will only return those 15 characters.   In other words, it doesn't pad the rest with spaces or anything like that.

In any case, I'm up to the point where I can do what I need to do.  So I'm making progress.

I'm not sure yet how to know when I've reached the last line of text in the textbox?

There's always some little thing I need to learn.

I can get the length of a list.   But how do I get the number of lines of text in a textBox widget?

 

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
triform
(@triform)
Member
Joined: 5 years ago
Posts: 324
 

@robo-pi


line_cnt = int
(txtBox_1_dict.index('end-1c').split('.')[0])

Should do it.

   
Robo Pi reacted
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
Topic starter  
Posted by: @triform

@robo-pi


line_cnt = int
(txtBox_1_dict.index('end-1c').split('.')[0])

Should do it.

Thanks, that works perfectly. 👍 

See, I would have never known how to do that because I had no clue about 'end-1c'.   In fact, I still have no clue about it. 😆 

Where would I go to discover all these secrets?

I've been using this page:

Python - GUI Programming (Tkinter)

It's been very helpful indeed.   In fact, if you scroll down the page to the Text widget and click on that it takes you to a page that tells a lot about how to use the Text widget.   But it doesn't give the extreme details like using 'end-1c'.  Those are the types of little secrets that can drive a newbie insane trying to discover. 

Do you have any links to any web pages that reveal all these secrets?

I knew that I could type in .index(line.column), so I was aware of that much.  But I would have never guessed that using 'end-1c' would return the index of the final line in the text box.   That's exactly what I needed. 😊 

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
triform
(@triform)
Member
Joined: 5 years ago
Posts: 324
 

@robo-pi

No problem.  I use https://tkdocs.com/ and the https://wiki.tcl-lang.org/ . Tk has been used under the covers for a few decades now, hidden away from general site 🙂  The Wiki will have some of the old comp.lang.tcl goodies there as well. 

Scott


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
Topic starter  

The Final Video:

Here's my final video of this series.   In this video I simply share how I programmed my Alysha GUI Dictionary.   It's not a finished program and I would like to make a lot more additions and improvements.  But that will happen over time.  For now I thought I'd just share what I've done for anyone who might be interested in doing something similar.   If you never worked with Tkinter this may help you understand how to program GUIs using Tkinter.

Here's the video:

Here's a link to a web page that provides an easy way to look up information about the most popular Tkinter widgets.  Just scroll down the page and click on the widget you are interested in and it will take you to a page that explains the options for that widget.

Python - GUI Programming (Tkinter)

There's also this entire video series on Tkinter if you want to learn more about Tkinter:

 

DroneBot Workshop Robotics Engineer
James


   
byron and codecage reacted
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
Topic starter  

Here's a link to the Python code on GitHub:

Alysha GUI Dictionary

DroneBot Workshop Robotics Engineer
James


   
byron and codecage reacted
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1037
 

@robo-pi

James, you have been an immense help getting over the hump of understanding how to start using TKinter.  And the fact that you have tied it into the eSpeak series is awesome!

Wow, time to move on to pocketSphinx!!

Or is it get the tires on the Chevy and get the grass cut?  😎 

SteveG


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1121
 

@robo-pi

Thanks for the videos and links.  As the summer hots up things are getting busy for me.  The cheeky postman just commented on the length of grass on the front lawn. Another thing for the list, but I will certainly not be doing it with a push mower. 🤨  My electronic tinkering is on the back burner for now, but all your good efforts will make good viewing and reading come the Winter months.  I expect your bot will be zipping around by then, and probably a few more videos to view. 👍  I hope so.  


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
Topic starter  
Posted by: @codecage

Or is it get the tires on the Chevy and get the grass cut?

Yep, that's the agenda today.  Mowing the lawn first.  Then back to work on the Chevy.   It will probably take me a month or two to get all four tires changed.  Not because it's hard to do.  I could actually do all four tires in one day if that's all I was doing.  But I'm going over the brakes and checking other things on each wheel as well.   In fact, this first wheel I took of is actually frozen up and won't turn.  It's a front wheel.  So I need to get the brake drum off and see what's going on under there.  The current problem is how to get the drum off.  There's no way to pound on it from behind, and I don't have a brake drum puller.  I might have to make one.

But yeah, I would love to move forward with Pocket Sphinx!   I actually had it installed and working at one time.  But I decided to start everything over from scratch for the sake of bringing you guys along for the ride. 😊 

Actually I am hoping to find some people who might be interested in my Linguistic AI project eventually.  So that's one reason I'm making these videos.  I can just point them to theses series and they can catch up to where I'll be at that time.

I think the actual Linguistic AI project is going to be quite interesting.   But that's far off in the future.  I might be driving my 1947 Chevy by then. 😎 

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1037
 

@robo-pi

If you can't tell I'm interested and hope i can contribute some day as well.

SteveG


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
Topic starter  
Posted by: @codecage

James, you have been an immense help getting over the hump of understanding how to start using TKinter.

I've actually been putting off learning Tkinter myself.   But now that I really wanted to write a GUI program I dove right in.  It turns out to be pretty easy to use.

There are a lot of little subtle things you need to code for, which I haven't done.  For example,  you can keep opening as many Alysha Windows as you want by just clicking on the Open Alysha button repeatedly.

We don't want that.  So I'll need to add some code to check to see if the window is already open and not allow multiple copies to be opened. 

I didn't bother programming any of those kind of checks into this program, so it's full of potential "bugs".

I was trying to keep it as simple as possible just to get the thing up and running.  We can add all the bells and whistles later.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Page 8 / 8