#!/usr/bin/env python3 import os import subprocess as sp import tkinter as tk import sqlite3 from tkinter import * from tkinter import ttk from tkinter import font from ttkthemes import ThemedTk from tkinter import PhotoImage from tendo import singleton import subprocess #setting up window pexs = ThemedTk(theme='clam') window_height = 130 window_width = 350 pexs.title('No Connection!') pexs.tk.call('wm', 'iconphoto', pexs._w, tk.PhotoImage(file='/usr/share/pixmaps/peppermint-old.png')) pexs['bg']='#2f2f2f' #keep only instance at a time me = singleton.SingleInstance() #main information syles subpmt = ttk.Style() subpmt.configure("Whiteb.TLabel", foreground ="#ffffff", background ="#2f2f2f", font = ('Helvetica', '14', 'bold') ) #style the buttons stbnt = ttk.Style() stbnt.configure('pep.TButton', font = ('Helvetica', '14', 'bold')) stbnt.map("pep.TButton", foreground=[('!active', '#F62817'),('pressed', '#2f2f2f'), ('active', 'white')], background=[ ('!active','#2f2f2f'),('pressed', '#2f2f2f'), ('active', '#2f2f2f')], ) cbtn = ttk.Style() cbtn.map("hpep.TButton", foreground=[('!active', '#F62817'),('pressed', 'white'), ('active', '#F62817')], background=[ ('!active','#2f2f2f'),('pressed', '#2f2f2f'), ('active', '#2f2f2f')] ) def center_screen(): """ gets the coordinates of the center of the screen """ global screen_height, screen_width, x_cordinate, y_cordinate screen_width = pexs.winfo_screenwidth() screen_height = pexs.winfo_screenheight() # Coordinates of the upper left corner of the window to make the window appear in the center x_cordinate = int((screen_width/2) - (window_width/2)) y_cordinate = int((screen_height/2) - (window_height/2)) pexs.geometry("{}x{}+{}+{}".format(window_width, window_height, x_cordinate, y_cordinate)) def killme(): pexs.destroy() #Message information lblexp = ttk.Label(pexs, style="Whiteb.TLabel", text="Cannot connect to CodeBerg!", wraplength=500) lblexp.place(x=30, y=30) ###All the buttons and placements## bttut = ttk.Button(text='Close', style="pep.TButton", width=8, command=killme ) bttut.place(x=120, y=70) #call Center screen center_screen() pexs.mainloop()