I found very less tkinter tutorials, hope this helps anyone looking forward for code.

There are lots of tutorials out there for web development, but actually a very few for GUI application building, and GUI applications to build with python one solution is Tkinter.

My app.py code

from tkinter import *
from models import *
window = Tk()
window.title(“Join”)
btn=Button(window, text=”OK”, fg=’blue’)
btn.place(x=130, y=150)
lbl=Label(window, text=”This is Label widget”, fg=’red’, font=(“Helvetica”, 16))
lbl.place(x=60, y=50)
txtfld=Entry(window, text=”This is Entry Widget”, bd=5)
txtfld.place(x=80, y=100)
window.title(‘Hello Python’)
window.geometry(“300x200+10+10”)
window.mainloop()

My models.py code

from tkinter import *
import psycopg2
try:
conn = psycopg2.connect(database="flaskmovie"…


A little bit about templates in flask.

My flask file structure.Simply store all your main code, back end code in app.py. Then all the layout arrangement, template code is in templates.

Image by Author

Then inside the templates folder store the html files. The index.html bears layout for the main page, that is home page of app.py. In the code the one that routes to home, or index. The v_timestamp.html bears code for the v_timestamp page.


A little bit about static in flask

The file structure in flask

When we want to store an image in our web application made from flask, we can store the image in the folder we allocated for flask app, containing the app.py, scripts. The folder i allocated is look, and within look folder, i made a sub folder called static.


Easy to follow guide

First of all check if you have already installed jdk in your computer. Go to command prompt(cmd).

In search bar type cmd and press enter.

Source:Google

Type java in the cmd and press enter.


hello world with java …make errors and become better, accidentally success doesn't help us to think like a compiler

Let’s compile our first code. I hope you have installed the Java Development Kit, and Java Runtime Environment. Then open up a text editor and type up this code.

class helloworld{
public static void main(String[] args) {
System.out.println("Hello World!");
}
}

System.out.println (s.o.p) tells the computer to display the output of what is written inside the brackets of s.o.p, “” marks.Now save this code as helloworld.java

In the command prompt or terminal .Type the following lines to compile the file.

javac…


conda commands in one tutorial

Please have conda installed yet to computer.

When I was working on Windows I could install mysql, mariaDB, and work with all. Lately in my ubuntu environment I installed mysql first. Then I got a project to work with mariaDB. Then i had to uninstall mysql to install mariaDB. So the best option was conda environment. I could keep mysql and mariaDB on the same computer yet with no issues. In one conda environment I made, there was installed mysql, on the other environment was installed mariaDB.

No issues not only for ubuntu users, but…


Yes we can call a function from a print statement and we do get an output…

Hi, this is a short tutorial to demonstrate that yes we can call a function from a print statement and we do get an output.

Say we have a function written in python to get the summation of two numbers.

def my_sum(x,y):
return x+y

Now we can call the summation function from within the print statement. Hence the print statement gives us the output of the return statement.

print(my_sum(2,3))

The complete code

def my_sum(x,y):
return x+y
print(my_sum(2,3))

Hence we get the output 5.

Thanks for reading…

Have fun coding !!!


The sudden crashes of gedit or difficulty of vim are over…

I used to be a windows user, had got used to sublime-text. I shifted over to Ubuntu and still wanted to use sublime text.

In ubuntu terminal to get a new file in gedit we use.

sudo gedit helloworld.php

Then we get the file called helloworld.php and we write code in that, now to get sublime-text. I m assuming at this point as an user you have got sublime text installed to ubuntu. In the terminal type the command as given below.

subl helloworld.php

Then in sublime text a new file called helloworld.php is open. Type the code and save.

Have fun coding…

Dul’s Blog

Student at University of Moratuwa

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store