Making a Sodium Chloride Solution attempt 3
So further to my previous video, where I measure out the required amount of Sodium Chloride, this video illustrates mixing the solution in a 100ml volumetric flask
Two parts to this video
Tags
Making a Sodium Chloride Solution attempt 3
So further to my previous video, where I measure out the required amount of Sodium Chloride, this video illustrates mixing the solution in a 100ml volumetric flask
Two parts to this video
Tags
Code Club – Trinket and python Modules
Trinket allows you to use a number of different modules to add functionality to your programs.
Code Club have added a py5 module for their own projects. So this post will examine how to add one of the available libraries to your program.
Firstly a list of the modules that Trinket.io provides can be found here. along with some documentation for each.
So to add a module we need to use the import command.
Start with a blank new Python 3 project and enter the following
#!/usr/bin/env python3 #use python 3
Then the instruction to import the required module.
import numpy
Now test if you don't get errors proceed to add
from numpy import *
And test again.
Should give no errors, in which case you can now start to use module numpy
Other info
You can use modules such as Numpy and matplotlib in software such as Jupyter Notebook
Tags
Subscribe to Librelounge podcast with vlc
In today's video, I do a quick run through on how to subscribe to the Librelouge podcast using the vlc media player.
I am already subscribed to this, so before I paste the link in I remove the existing entry. But this also illustrates that it is just as easy to remove subscriptions.
#podcast,#vlc.#subscription,#rss,#media,#howto,#help, #support,#LibreLounge
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License
Add new users to Debian
To do this you need to install gnome-system-tools then from the menu select Users and Groups
apt install gnome-system-tools
The video below illustrates the, short, simple process of adding new users to your system.
#debian,#add,#new,#user,#howto,#help,#support,freesoftware
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License
Add more functions
I have added a few more maths functions to the application and also provided a clear function. There are still a few items to add to help improve debugging but the application is starting to take shape.
Notes
window = Tk()
window.title('Maths Application')
window.geometry("570x150") # w x h
window.resizable(0,0)
The above code is being modified as I go. So I am changing the window size depending on what is being displayed.
I have also made the Window title reflect the purpose of the application.
That the source code now has 'result' as a label rather than output. This will show up future screenshots.
The code for the above is as follows.
#!/usr/bin/env python
import Tkinter # note use of caps
from Tkinter import *
window = Tk()
window.title('Maths Application')
window.geometry("570x150") # w x h
window.resizable(0,0)
#define button actions
def btn1():
#convert box text in to integers
ent1 = int(entrytext.get())
ent2 = int(entrytext2.get())
#add the 2 integers and store in variable add
add = (ent1 + ent2)
print (add)
#insert value of variable add in to box outtext
outtext1.insert(0,str(add)) # insert response
def btn2():
#print("subtraction")
ent1 = int(entrytext.get())
ent2 = int(entrytext2.get())
#subtract the 2 integers and store in variable sub
sub = (ent1 - ent2)
#insert value of variable sub in to box outtext
outtext1.insert(0,str(sub)) # insert response
def btn3():
#print("multiply")
ent1 = int(entrytext.get())
ent2 = int(entrytext2.get())
#multiply the 2 integers and store in variable mul
mul = (ent1 * ent2)
#insert value of variable mul in to box outtext
outtext1.insert(0,str(mul)) # insert response
def btn4():
#print("divide")
ent1 = int(entrytext.get())
ent2 = int(entrytext2.get())
#multiply the 2 integers and store in variable div
div = (ent1 / ent2)
#insert value of variable mul in to box outtext
outtext1.insert(0,str(div)) # insert response
#clear boxes
def clear():
#print("clear boxes") # leave in for legacy testing
entrytext.delete(0, END) # clear input box
entrytext2.delete(0, END) # clear input box2
outtext1.delete(0, END) # clear output box
btn_tog2 = Button( window, text ='+', command=btn1) # add
btn_tog3 = Button( window, text ='-', command=btn2) # subtract
btn_tog4 = Button( window, text ='x', command=btn3) #multiply
btn_tog5 = Button( window, text ='/', command=btn4) #divide
btn_tog6 = Button( window, text ='Clear', command=clear) #clear
btn_exit = Button( window, text ='Exit',command=exit) #exit
# define some labels
box1 = Label(window, text="1st Value")
box2 = Label(window, text="2nd Value")
box3 = Label(window, text="Result")
#define entry box
entry1 = StringVar() # this is our entry box
entry2 = StringVar()
entrytext = Entry(window, textvariable=entry1) # this is our entry box
entrytext2 = Entry(window, textvariable=entry2) # this is our second entry box
#define out box
entry2 = StringVar() # this is our output box
outtext1 = Entry(window, textvariable=entry2) # this is our output box
#display boxes
entrytext.grid(row = 3, column = 2,) #display entry box
entrytext2.grid(row = 3, column = 3,) #display entry box
outtext1.grid(row = 3, column = 4,) #display output box
#place labels
box1.grid(row = 1 , column = 2, padx = 5, pady = 5)
box2.grid(row = 1 , column = 3, padx = 5, pady = 5)
box3.grid(row = 1 , column = 4, padx = 5, pady = 5)
#buttons
btn_tog2.grid(row = 4, column = 2, padx = 1, pady = 1) # addition button
btn_tog3.grid(row = 4, column = 3, padx = 1, pady = 1) # subtraction button
btn_tog4.grid(row = 5, column = 2, padx = 1, pady = 1) # multiply button
btn_tog5.grid(row = 5, column = 3, padx = 1, pady = 1) # divide button
btn_tog6.grid(row = 4, column = 6, padx = 1, pady = 1) # clear button
btn_exit.grid(row = 3, column = 6, padx = 1, pady = 1) # exit button
window.mainloop()
The code that I used for a previous application to detect if numerical values have been used is below but provided 'as is' for now.
def response():
msg = "error : must be a text value"
i = circletext.get()
y = i.isdigit()
l = len(circletext.get())
#print l
if y == True or l == 0:
circletext.insert(0,(msg))
else:
x = random.choice(RESPONSES)
circletext2.delete(0, END) # clear prev output
circletext2.insert(0,str(x)) # insert response
I will integrate a version of this in to the main code.
#python, #tkinter, #programming, #python, #graphic, #applications, #bugs, #troubleshooting, #howto, #paignton, #library, #virtual, #codeclub
Happy to provide help and support via decentralised social media. I can be contacted on Mastodon here. You can get a free account on the http://qoto.org instance by following this link.
Addition Application
So following on from the previous posts, I am how sharing a small application, that makes use of what we have been learning.
This presents 2 input boxes and an output box, any values entered in to the first two, the sum is placed in to the last box.
This is not perfect, but getting there slowly.
We need to:-
The code for the above is as follows.
#!/usr/bin/env python
import Tkinter # note use of caps
from Tkinter import *
window = Tk()
window.title('App 1')
window.geometry("650x125") # w x h
window.resizable(0,0)
#define button actions
def btn1():
#convert box text in to integers
ent1 = int(entrytext.get())
ent2 = int(entrytext2.get())
#add the 2 integers and store in variable add
add = (ent1 + ent2)
print add
#instert value add in to box outtext
outtext1.insert(0,str(add)) # insert response
btn_tog2 = Button( window, text ='button1', command=btn1)
btn_exit = Button( window, text ='exit',command=exit)
# define some labels
box1 = Label(window, text="Entry 1: ")
box2 = Label(window, text="Entry 2: ")
box3 = Label(window, text="Ouput1: ")
#define entry box
entry1 = StringVar() # this is our entry box
entry2 = StringVar()
entrytext = Entry(window, textvariable=entry1) # this is our entry box
entrytext2 = Entry(window, textvariable=entry2) # this is our second entry box
#define out box
entry2 = StringVar() # this is our output box
outtext1 = Entry(window, textvariable=entry2) # this is our output box
#display boxes
entrytext.grid(row = 3, column = 2,) #display entry box
entrytext2.grid(row = 3, column = 3,) #display entry box
outtext1.grid(row = 3, column = 4,) #display output box
#place labels
box1.grid(row = 1 , column = 2, padx = 5, pady = 5)
box2.grid(row = 1 , column = 3, padx = 5, pady = 5)
box3.grid(row = 1 , column = 4, padx = 5, pady = 5)
#buttons
btn_tog2.grid(row = 3, column = 5, padx = 5, pady = 5)
btn_exit.grid(row = 3, column = 6, padx = 5, pady = 5)
window.mainloop()
#python, #tkinter, #programming, #python, #graphic, #applications, #bugs, #troubleshooting, #howto, #paignton, #library, #virtual, #codeclub
Happy to provide help and support via decentralised social media. I can be contacted on Mastodon here. You can get a free account on the http://qoto.org instance by following this link.
Scratch : Share projects
By default, Scratch projects are set to private. This means that only you can edit them. This feature helps to keep users safe. However the very nature of Scratch is collaborative and you are encouraged to share, but remember to be safe while you are sharing, Ask a grown up first.
To share your new project:
Don't worry if you forget to give your project a name, clicking on the share button brings up this screen.
Adding to a studio
Method 1
From the above screen you will see there is an Add to studio button near the bottom right
Method 2
If you click on your name in the corner, click my stuff you are then taken to this screen, where you can share your project with a studio you are following.
You do this by clicking Add to and selecting the studio from the list.
#scratch, #share, #project, #howto
Following Friendica tags
On Friendica, posts are accompanied by tags at the bottom of the text. These help to give an idea on what topic or topics are being discussed by including keywords.
If you are interested in a particular topic, then you can follow the tags you are interested in.
Here is how:
Click on a tag and you get the following displayed, you can see the tag you clicked on has been inserted in to the box.
Click follow and the tag will be added to the list on the left hand side. You will now see posts that contain those tags.
following #newhere, will help you find new users, so you can respond to them and make them feel welcome.
#friendica, #tags, #follow, #howto, #help, #support, #fediverse
You can find me on Friendica at [email protected]