Paul Sutton

add

Add Duckduckgo to firefox.

Further to my post on the 17th December.

It was rightly pointed out, that I should be using a browser other than Chrome. To this end, I have made a video illustrating how to add Duckduckgo to the Firefox web browser.

#firefox,#add,#duckduckgo,#extension

Creative Commons Licence
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

Creative Commons Licence
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License

Adding CC Images To Photos

This is a re-post from December 2019

If you create lots of media such as photos or graphics. You may want to add information pertaining to the copyright (or ideally copyleft) of the image.

As I am interested in Creative Commons (CC) then it makes sense to be able to add one of the many creative commons license logos to an image.

I asked on Friendica about how to do this (having tried and failed before) and was provided with some help and a really useful shell script to automate the process.

Firstly we need an image to modify and a logo image to add to this:

cc-by logo

Example logo file to insert

cc-by logo

For the sake of this article, I am just using a random photo I took of Paignton Geopark. I have also reduced the image size to 640×480 to make it smaller for the website as per command below.

gm mogrify -resize 640×480 *.JPG

I also had to convert the jpg files to png files with the following

gm convert DSCF0182mod.jpg DSCF0182mod.png

So that this blog would display the images.

The next step is to create a folder structure to contain what we need to undertake the work.

What we need is a new folder

Inside this, we need another folder called out

mkdir out

we need some more files mostly the cc logos, these are available from a simple duckduckgo search.

Note if putting on a website or other media you need to properly include the creative commons license being used on here I have put

''' Licenced under Attribution 4.0 International (CC BY 4.0) '''

Which should then link to the human readable license terms you want to use.

So what we should have is

\insertcc-logo\insertcc.sh

\insertcc-logo\out

\insertcc-logo\out\88×31.png

\insertcc-logo\out\88×31-sa.png

\insertcc-logo\out\cc-zero.png

etc

Put the SOURCE FILE in \insertcc-logo

MODIFY AND RUN the script below

Our script looks like ( save this as insertcc.sh or what you want to call this )

for p in *.JPG; do convert “$p” ./out/88×31.png -gravity southeast -geometry +10+10 -composite “out/$p”; done

What the script does is take each file with the JPG extension (or other extension), add the required logo, and save the modified file in

\insertcc-logo\out

As per :

cc-by logo

You need to make sure that the script points to the correct source files.

You also need to point the script to the correct file you want to insert in to your source image.

for p in *.JPG;

To use a different logo change this section of the script

$p” ./out/88×31.png

This article originally appeared on http://www.zleap.net.

#photo,#embed,#add,#creativecommonslogo,#linux #graphicsmagick,#editing,#manipulation,#bash,#commands, #media,#copyleft,#attribute,#share,#alike,#sharealike, #commons,#freedom,

You can find me on Friendica at zleap@social.isurf.ca


cc-by logo

Licenced under Attribution 4.0 International (CC BY 4.0)

Adding items to the XFCE Panel

This is a quick video, created with Vokoscreen to illustrate the process of adding an item to the XFCE4 Panel

#video,#peertube,#debian,#xfce4,panel,#add,new,#item

Adding games to Debian Xfce menu

Yesterday, I wrote briefly that I am now using snaps, this works really well, but does not add items to the Debian XFCE menu automatically.

To solve this I have installed menulibre, which helps users edit the menu.

apt install menulibre

So adding items to this is fairly straight forward.

  1. Load up the menulibre program.

menu —> accessories —> Menu Editor

Launch Program from menu

Once loaded you will be presented with:-

Main Program screen

The + in the corner allows users to add a new entry.

Click on the appropriate place in the menu to add your program to where you want it. You can also move items around with the up / down arrows at the bottom, don't forget to save (see later) what you have changed.

menu 1

You can then enter the details of the program. To save there is an icon to the right of the + Depicting an arrow pointing towards a disk drive. Click this to save.

You can then test to make sure your entry works.

#debian,#buster,#menu,#add,#item,#menulibre

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)
  1. The above code is being modified as I go. So I am changing the window size depending on what is being displayed.

  2. I have also made the Window title reflect the purpose of the application.

  3. That the source code now has 'result' as a label rather than output. This will show up future screenshots.

addition app

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.

cc-by logo

Licenced under Attribution 4.0 International (CC BY 4.0)

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.

addition app

This is not perfect, but getting there slowly.

We need to:-

  • Fix the name of the button from button1
  • Detect if the user has entered numerical values
  • Detect for empty boxes
  • Make labels more useful
  • Fix spelling in comments
  • Fix clarity of comments

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.

cc-by logo

Licenced under Attribution 4.0 International (CC BY 4.0)