Paul Sutton

python

More Trinket Coding

Trinket is a web based development platform. One of it's features is the programming language blocks, which is in fact a block based front end and creates Python programs.

I am sharing these on my blog today, even though I also shared earlier in the week on LinkedIn and also on Twitteras part of the Paignton Library Virtual Code Club.

Drawing a circle

circle1

And the associated output

circle1

Drawing a star

star1

And the associated output

star2

I am working on a book to update my previous Nested loops guide I wrote a few years ago. This needed updating anyway so it would cover Scratch 3.0. This book / guide is work in progress, and will be typeset in $\LaTeX$ using Overleaf

#programming, #trinket, #Blocks, #python, #WebIDE, #LaTeX, #Overleaf, #nestedloops, #loops, #codeclub

cc-by logo

Licenced under Attribution 4.0 International (CC BY 4.0)

At Paignton virtual Code Club, we are now approaching the end of the Scratch modules. Well done to everyone. The next step is probably to progress to Python [2][3].

If you don't feel ready to do lots of typing, you may want to look at Trinket and blocks. Then perhaps move to the Code Club modules [3].

Blocks, as the name suggests, is a block based system. The difference here is, that the blocks are all Python statements and code. So combining these allow you to easily start coding in Python.

To get started you need to sign up for an account on the Trinket website [1]

trinket

Click you user name and select new trinket and then select blocks

select blocks

You are now presented with your development area.

dev area

You may want to change your project title to something meaningful.

change title

You can select the category of block, then simply use click / drag in similar way as you would with Scratch.

So in this example I am just going to draw a square.

draw square

As we are using turtle, you will need to change the pen up, block so that it says pen down.

change command

Adding comments to your code is important, as it helps you keep track of what the code is doing and helps with debugging also helps others understand your code.

add comment

You can also view the Python code that is produced, this can be copy / pasted to IDE so you can just run the Python code on its own.

![View Python]

https://raw.githubusercontent.com/zleap/blogmedia/master/trinket/square-python-code.png

Finally you can share your project with others.

share

Hopefully this is helpful.

Resources

1 Trinket 2 Python 3 Code Club python Modules

#codeclub,#paignton,#trinket,#python,#coding,#skills,#technology

cc-by logo

Licenced under Attribution 4.0 International (CC BY 4.0)

IRC bot development

I have been working on some more projects around IRC chat bots. I decided to try and integrate a Magic 8 ball project so that an IRC bot would give a random response, chosen from a pre- defined set within the code (can be changed) when the bot is sent an instruction in my IRC channel.

ircbot

This project builds on some of the code covered in my Minecraft Pi bot project. Mostly the base code from the Linux Voice article.

The code is currently being tested in ##zleap on Freenode.

At the moment magic8 can be sent the following commands:-

  • !umame – returns output of uname -a
  • !uptime – returms system uptime
  • !help – displays list of options
  • !botexit – bot quits irc channel,
  • !magic8 – returns random text
  • !ping – returns pong (used to check the bot is working, left in for legacy
  • !web – returns my own web address (this website) but can be changed
  • !sdtj – returns web address for the South Devon Tech Jam

Notes

uname and uptime are Linux / Unix commands, it is therefore assumed you are running on a GNU / Linux system.

I have created a welcome message from the bot, so when it joins it says hello, also says goodbye if !botexit is sent.

Todo

  • Make the code Python 3
  • Add more options
  • Keep it tidy

Help and Contribute

Feel free to fork the project and make improvements and further customization. Perhaps discuss further on IRC or via social media e.g Mastodon.

Resources

#python, #development, #irc, #application, #bot, #magic8, #network,#sockets #irc, #project,#github, #chat, #responses, #magic8

A few years ago, Linux Voice published a really simple IRC bot project in the magazine. I took this and managed to get it to connect to a minecraft Pi game and I could use IRC to send instructions to the game.

In the screenshot below the bot has received an instruction to execute uname -a and the output is directed to the game screen.

mc-irc-bot-thingy

To get all this to work you need:-

  • An IRC client
  • A raspberry pi which should be running Minecraft Pi and the python program, once the game has started the bot should connect.

You also need to connect to either:-

  • An existing IRC server or
  • Your own irc server, which can be another Raspberry Pi on the same network running an IRC server.

note You need to ask if it is Ok to connect bots to IRC servers.

In my code it is connecting to a Raspberry Pi (original model) running an IRC server.

It does work, but there is probably potential here for expansion and improvement.

Resources

#python, #development, #irc, #application, #minecraft, #network,#sockets #irc, #project,#abandonware,#github

Have fun.

You can find me on Friendica at [email protected]


cc-by logo

Licenced under Attribution 4.0 International (CC BY 4.0)

A few years ago, I wrote a Python script (probably badly) that created a TkInter graphical user interface, that would link to some of the Minecraft Pi API functionality. The idea being that a few common commands, would be available at the touch of a widget button.

mc-pi-gui

The program is pretty basic. It may, be useful to someone out there, at least a starting point. I have therefore put the project back on GitHub.

I am happy for someone to fork and or take over the project or contribute further. I can be found on IRC (freenode) as zleap.

Resources

#python, #development, #tkimter, #application, #minecraft, #graphicaluserinterface, #gui, #project,#abandonware,#guthub

You can find me on Friendica at [email protected]


cc-by logo

Licenced under Attribution 4.0 International (CC BY 4.0)

Programming and AI: A Guide for Parents

This was posted to LinkedIn. I am sharing here as it may be of interest to anyone looking at where the industry is moving and gives an idea of what to be learning. It is also important for parents to understand so they can support learning.

I would encourage everyone to learn to code, I would encourage parents to learn what this is about so they can support their children. After all events such as Code Club or the Tech Jam would require parental permission.

It is also important for parents to understand so they can talk to their children about what they are doing, help them find information and sort out the bad information from the good, understanding how to use online forums and importantly stay safe by not sharing personal or private information.

While learning at home is possible, being able to meet up with other developers helps solve problems, builds social skills and you can get help with bigger projects leading to developing team and leadership skills, all very important to employers.

Programming and AI: A Guide for Parents – Nisha Talagala – Medium

Programming and AI: A Guide for Parents

Article links

Where to learn (or where to get started)

You can learn these skills from a wide range of providers both physical colleges / universities or via online learning,

The developer roadmap may also be of interest,

While schools can help so can events such as Tech Jams or code club. Adults such as youth workers need to understand this technology so they can encourage the learning and not discourage through not understanding and fear that comes with that.

#AI, #parents, #guide, #programming, #medium, #LinkedIn, #Python, #docker, #github, #linux

Code Club 1/2/2020 reminder

Code Club 01/02/2020

The next Code Club will be Tomorrow: Saturday 1st February at Paignton Library and information Centre.

Carrying on from what we were doing on 18/1/2020, If anyone is interested in the Hour Of Code activity, we can have a go at that too.

More Scratch 3.0 coding, which is great and a good starting point before moving on to other programming languages.

cc-by logo

Rocksndiamonds. which I hope we can eventually use to learn level layout.

We can also take a look at the Tech Pledge. See what people think about this as an idea to make the internet a nicer place. I will have copies printed out.

Also hope to get some feedback and input on my e-safety for coding website project that I am working on in repl.it .

References and further information

#coding, #codeclub, #programming, #scratch, #python, #html, #css, #javascript,#coding

You can find me on Friendica at [email protected]


cc-by logo

Code Club 01/02/2020

The next Code Club will be on Saturday 1st February at Paignton Library and information Centre.

Carrying on from what we were doing on 18/1/2020, If anyone is interested in the Hour Of Code activity, we can have a go at that too.

More Scratch 3.0 coding, which is great and a good starting point before moving on to other programming languages.

cc-by logo

Rocksndiamonds. which I hope we can eventually use to learn level layout.

References and further information

#coding, #codeclub, #programming, #scratch, #python, #html, #css, #javascript,#coding

You can find me on Friendica at [email protected]


cc-by logo

Code Club 18/1/2020 Write up

Today at Code Club we had 8 attendees, which is a really good So we had more scratch, and did some more work on the website project.

There was some interest in Micro:bits but not that much. This is something for future sessions. Or even a dedicated session at the library for this. Which may work better.

I also trying and get a Lego Mindstorms Robot built, but this takes time.

We also had Lucy, from the Tech Jam drop in and this resulted in a few e-mail between myself and Lucy go discuss learning platforms.

Next Code Club is on Saturday 1st February 2020.

#coding, #codeclub, #programming, #scratch, #python, #html, #css, #javascript,#coding

You can find me on Friendica at [email protected]


cc-by logo

Code Club 18/01/2020

The next Code Club will be on Saturday 18th January at Paignton Library and information Centre

Carrying on from what we were doing on 4/1/2020. If anyone is interested in the Hour Of Code activity, we can have a go at that too.

More Scratch 3.0 coding, which is great and a good starting point before moving on to other programming languages.

Rocksndiamonds. which I hope we can eventually use to learn level layout.

cc-by logo

References and further information

Next week 11th January 2020 is the South Devon Tech Jam

Next Code Club is on : Saturday 18th January 2020

#coding, #codeclub, #programming, #scratch, #python, #html, #css, #javascript,#coding, #games, #rocksndiamonds, #hourofcode

You can find me on Friendica at [email protected]


cc-by logo