Archive for the ‘Windows Development’ Category

Make Baymax software for PC

Everyone who has seen the movie Big Hero 6 will be familiar with the name Baymax. In the movie, Baymax was Personal Healthcare Companion Robot created by Tadashi Hamada to scan everyone and work as a robotic nurse. When I first saw the movie I loved the way Baymax greeted the Hero Hamada when he first turns it on. That made me decide to make software for PC that greets us whenever we turn on our computer. You can make your own Baymax using the following commands before we go on with the coding you need to have drag and drop one tool called Timer on our main screen like Pic 1.1

1

Pic 1.1

When you click on Timer you can see one Properties Box on Bottom Right corner. Next you need to change the default Properties of Timer as shown below:

5

Now we can move to the Coding part but first, we need to add some Reference to our Project. For that go to “Project” and Click on “Add Reference” and search for “System.Speech” and you need to select these Reference.

Next Below

using System.Windows.Forms;

you need to add these extra namespace like the following

 

using System.Speech.Recognition;

using System.Speech.Synthesis;

using System.IO;

using System.Globalization;

using System.Threading;

using System.Xml.Linq;

using System.Xml;

using System.Web;

Next Below

 

public partial class Form1 : Form

{”

 

Copy the following codes:

 

Random rnd = new Random();
SpeechSynthesizer Baymax = new SpeechSynthesizer();
SpeechRecognitionEngine reg = new SpeechRecognitionEngine();
private DateTime timenow;
String userName = Environment.UserName;”

 

Next Below

 

public Form1()

{

InitializeComponent();”

 

 

Copy the following codes:

 

“timenow = DateTime.Now;

if (timenow.Hour >= 1 && timenow.Hour < 5)

{ Baymax.Speak(“Goodmorning, Its currently ” + timenow.GetDateTimeFormats(‘t’)[0] + “. I think you should sleep now, it’s too early. Wish you have a good sleep” + userName); }

if (timenow.Hour >= 5 && timenow.Hour < 9)

{ Baymax.Speak(“Goodmorning, Its currently ” + timenow.GetDateTimeFormats(‘t’)[0] + “. I think you have slept peacefully. have a nice day” +userName ); }

if (timenow.Hour >= 9 && timenow.Hour < 12)

{ Baymax.Speak(“Goodmorning, Its currently ” + timenow.GetDateTimeFormats(‘t’)[0] + “. how’s the day going ” + userName); }

if (timenow.Hour >= 12 && timenow.Hour < 18)

{ Baymax.Speak(“Good afternoon, Its currently ” + timenow.GetDateTimeFormats(‘t’)[0] + “. It is good to see you again ” + userName); }

if (timenow.Hour >= 18 && timenow.Hour < 24)

{ Baymax.Speak(“Good evening, Its currently ” + timenow.GetDateTimeFormats(‘t’)[0] + “. It is good to see you back ” + userName); }”

 

Now we are going to use the Timer we dragged from the Toolbox for that we are going to create a new string to check the date and time from our PC, as shown below:

 

public string time()

{

              DateTime timenow = DateTime.Now;

              string o = timenow.GetDateTimeFormats(‘t’)[0];

              return o;

}”

 

Now we are going to our last step, that is to give coding to our “ShutdownTimer” for that double click the Timer we made. When you click on Timer it leads you to the coding page as default the coding will be like this:

 

private void ShutdownTimer_Tick(object sender, EventArgs e)

{

                      #Paste your code here

}”

 

And paste the following code:

 

“ShutdownTimer.Enabled = true;

Close();”

 

Now you are ready to use your Baymax Startup software, you can test your software by pressing “F5”. Before you press “F5” make sure that you have closed every curly braces { }.

If you have any problem with your coding just leave a message 😉

You can download Baymax Code from the link below : https://github.com/stark25795/Baymax_Startup

You can download “How to make Baymax” PDF from the link below : https://drive.google.com/file/d/0BzQ8yfuAE9O1dkVLdFdhLS1JZlk/view?usp=sharing.

Installing Kivy on Windows

I found this really cool cross-platform toolkit for making GUIs from Python! It’s named Kivy. It’s available on Windows, Linux and Mac. (In case you’re not a developer, this is very cool!) The official installation instructions are here: https://kivy.org/docs/installation/installation-windows.html

However, I got an error when it tried to install gstreamer. I had to install that separately. What I did was download the wheel (.whl) file and install it first. After I did that, the rest of install worked fine. You can download the wheel file from here:
https://www.googledrive.com/host/0B1_HB9J8mZepNzZ5aW91Q0tJU2s/kivy.deps.gstreamer-0.1.5-cp27-none-win_amd64.whl

Open a command prompt/shell (of your choice), change to the directory where you downloaded the file and run:

pip install kivy.deps.gstreamer-0.1.5-cp27-none-win_amd64.whl

Note that I got an HTTP 502 error (yes, 502, or “temporary error”) for a while this morning, but then it worked. However, if that file does not exist (an HTTP 404 error), please check this page and download the appropriate file for your version of Windows and Python:
https://kivy.org/downloads/packages/simple/kivy-deps-gstreamer/

Finally, proceed with running everything from the official instructions. (Or everything that failed on you, if you’re sure what that was.)

Happy GUI development! 🙂

Return top

Info

Section9 is a computer club based out of the Springfield Missouri area. For more information, please see the About Us page or follow us on Facebook.
 
%d bloggers like this: