Paul Sutton

create

More tkinter : Combine buttons and labels.

Now that we can add a label and a button, it is time to combine the two. The following code does this.

#define functions for button(s)
def btn1():
	print ("button pressed")
	
	
#create button object	
btn_tog2 = Button( window, text ='button1', command=btn1)
btn_exit = Button( window, text ='exit',command=exit)	

#place button object
btn_tog2.grid(row = 1, column = 2, padx = 5, pady = 5)
btn_exit.grid(row = 2, column = 2, padx = 5, pady = 5)

#define labeles
button1 = Label(window, text="press button")
button2 = Label(window, text="exit program")

#place labels
button1.grid(row = 1, column = 1, padx = 5, pady = 5)
button2.grid(row = 2, column = 1, padx = 5, pady = 5)

We get:

tk label

#tkinter,#python,#gui,#programming.


MastodonPeertubeQoto sign up

Donate using Liberapay

Creating a write freely blog

Creating a blog post on a writefreely instance is a case of:

Logging in to your account, after which you are simply presented with your page where you can start typing.

Add a title, then the main body of your post.

I sometimes add a list of links, which relate to any items mentioned in my post. I then add a list of tags. Under that I usually have a sort of footer, which has copyleft information both in text and a graphic.

To add a picture you need to add some markdown which points to the location of the image.

![cc-by logo](https://raw.githubusercontent.com/zleap/blogmedia/master/88x31.png)

For the purpose of this, I am creating a draft, however once the post is finished, clicking on draft at the top, will allow me to 'publish to' a blog hosted by my account. Write freely allows for multiple blogs from the same login. Which is helpful for different subjects or topics for example.

resources

#writefreely, #create, #blog, #post

cc-by logo

Licenced under Attribution 4.0 International (CC BY 4.0)


MastodonPeertubeQoto sign up

Donate using Liberapay