1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
| #coding:utf-8
from tkinter import *
import os
import tkinter as tk
import webbrowser
from tkinter import messagebox
import subprocess
import time
from tkinter import ttk
from tkinter.filedialog import askopenfilename
#----------------------------------------------------------
#Ouverture fichier
def OpenFile1():
name1 = askopenfilename(initialdir="/",
filetypes =(("Text File", "*.txt"),("All Files","*.*")),
title = "Choose a file."
)
print (name1)
#Using try in case user types in unknown file or closes without choosing a file.
try:
with open(name1,'r') as UseFile:
print(name1)
except:
print("No file exists")
#----------------------------------------------------------
#Customisation Bouton
class HoverButton(tk.Button):
def __init__(self, master, **kw):
tk.Button.__init__(self,master=master,**kw)
self.defaultBackground = self["background"]
self.bind("<Enter>", self.on_enter)
self.bind("<Leave>", self.on_leave)
def on_enter(self, e):
self['background'] = self['activebackground']
def on_leave(self, e):
self['background'] = self.defaultBackground
#----------------------------------------------------------
#Menu Anti_Duplicate
def Anti_Duplicate():
global Anti_Duplicate
A_Duplicate = Tk()
A_Duplicate.resizable(width=False, height=False)
screenn_x = int(A_Duplicate.winfo_screenwidth())
A_Duplicate.config(background='#1c2028')
screenn_y = int(A_Duplicate.winfo_screenheight())
A_Duplicate.title("Anti-Duplicate v0.0.1")
windowss_x = 570
windowss_y = 340
possX = (screenn_x // 2) - (windowss_x // 2)
possY = (screenn_y // 2) - (windowss_y // 2)
geoo = "{}x{}+{}+{}".format(windowss_x, windowss_y, possX, possY)
A_Duplicate.geometry(geoo)
mainframe = Frame(A_Duplicate, bg='#1c2028')
mainframe.pack(side= TOP, ipadx= 5, ipady= 5)
bouton_1 = HoverButton(A_Duplicate, font=("Arial", 10), text="Back", background='#1c2028', fg='white', borderwidth=2, activebackground= '#202124', activeforeground='#1195cf', relief='ridge', command= A_Duplicate.destroy)
bouton_1.place(x=520, y=300)
open_button = HoverButton(A_Duplicate, font=("Arial", 10), text="Ouvrir un fichier..", background='#1c2028', fg='white', borderwidth=2, activebackground= '#202124', activeforeground='#1195cf', relief='ridge', command= OpenFile1)
open_button.place(x=229.5, y=200)
bouton_2 = Button(A_Duplicate, font=("Arial", 10), text="Cet outil a pour but de supprimer les lignes en double d'un fichier texte.", background='#202124', fg='#1195cf', borderwidth=2, activebackground= '#202124', activeforeground='#1195cf', relief='sunken')
bouton_2.place(x=75.5, y=50)
bouton_1 = Button(mainframe, font=("Arial", 15), text="Anti-Duplicate", background='#202124', fg='#1195cf', borderwidth=2, activebackground= '#202124', activeforeground='#1195cf', relief='sunken')
bouton_1.pack(padx= 5, pady=10, ipadx= 30)
# Menu Split
def Split():
global Split
Split_Window = Tk()
Split_Window.resizable(width=False, height=False)
screenn_x = int(Split_Window.winfo_screenwidth())
Split_Window.config(background='#1c2028')
screenn_y = int(Split_Window.winfo_screenheight())
Split_Window.title("Split v0.0.1")
windowss_x = 570
windowss_y = 340
possX = (screenn_x // 2) - (windowss_x // 2)
possY = (screenn_y // 2) - (windowss_y // 2)
geoo = "{}x{}+{}+{}".format(windowss_x, windowss_y, possX, possY)
Split_Window.geometry(geoo)
mainframe = Frame(Split_Window, bg='#1c2028')
mainframe.pack(side= TOP, ipadx= 5, ipady= 5)
bouton_1 = HoverButton(Split_Window, font=("Arial", 10), text="Back", background='#1c2028', fg='white', borderwidth=2, activebackground= '#202124', activeforeground='#1195cf', relief='ridge', command= Split_Window.destroy)
bouton_1.place(x=520, y=300)
open_button = HoverButton(Split_Window, font=("Arial", 10), text="Ouvrir un fichier..", background='#1c2028', fg='white', borderwidth=2, activebackground= '#202124', activeforeground='#1195cf', relief='ridge', command= OpenFile1)
open_button.place(x=229.5, y=200)
bouton_2 = Button(Split_Window, font=("Arial", 10), text="Cet outil a pour but de diviser un fichier texte, selon un nombre de lignes donné.", background='#202124', fg='#1195cf', borderwidth=2, activebackground= '#202124', activeforeground='#1195cf', relief='sunken')
bouton_2.place(x=50, y=50)
bouton_1 = Button(mainframe, font=("Arial", 15), text="Split", background='#202124', fg='#1195cf', borderwidth=2, activebackground= '#202124', activeforeground='#1195cf', relief='sunken')
bouton_1.pack(padx= 5, pady=10, ipadx= 30)
# Menu Fusion
def Fusion():
global Fusion
Fusion_Window = Tk()
Fusion_Window.resizable(width=False, height=False)
screenn_x = int(Fusion_Window.winfo_screenwidth())
Fusion_Window.config(background='#1c2028')
screenn_y = int(Fusion_Window.winfo_screenheight())
Fusion_Window.title("Fusion v0.0.1")
windowss_x = 570
windowss_y = 340
possX = (screenn_x // 2) - (windowss_x // 2)
possY = (screenn_y // 2) - (windowss_y // 2)
geoo = "{}x{}+{}+{}".format(windowss_x, windowss_y, possX, possY)
Fusion_Window.geometry(geoo)
mainframe = Frame(Fusion_Window, bg='#1c2028')
mainframe.pack(side= TOP, ipadx= 5, ipady= 5)
bouton_1 = HoverButton(Fusion_Window, font=("Arial", 10), text="Back", background='#1c2028', fg='white', borderwidth=2, activebackground= '#202124', activeforeground='#1195cf', relief='ridge', command= Fusion_Window.destroy)
bouton_1.place(x=520, y=300)
bouton_1 = Button(mainframe, font=("Arial", 15), text="Fusion", background='#202124', fg='#1195cf', borderwidth=2, activebackground= '#202124', activeforeground='#1195cf', relief='sunken')
bouton_1.pack(padx= 5, pady=10, ipadx= 30)
#Menu principal
def main_menu():
global main_menu
main_screen = Tk()
main_screen.resizable(width=False, height=False)
screenn_x = int(main_screen.winfo_screenwidth())
main_screen.config(background='#1c2028')
screenn_y = int(main_screen.winfo_screenheight())
main_screen.title("ComboKit v0.0.1")
windowss_x = 570
windowss_y = 340
possX = (screenn_x // 2) - (windowss_x // 2)
possY = (screenn_y // 2) - (windowss_y // 2)
geoo = "{}x{}+{}+{}".format(windowss_x, windowss_y, possX, possY)
main_screen.geometry(geoo)
mainframe = Frame(main_screen, bg='#1c2028')
mainframe.pack(side= TOP, ipadx= 5, ipady= 5)
bouton_1 = HoverButton(mainframe, font=("Arial", 15), text="Fusion", background='#1c2028', fg='white', borderwidth=2, activebackground= '#202124', activeforeground='#1195cf', relief='ridge', command=Fusion)
bouton_1.pack(side= LEFT, padx= 5, pady=5, ipadx= 30)
bouton_2 = HoverButton(mainframe, font=("Arial", 15), text="Anti-Duplicate", background='#1c2028', fg='white', borderwidth=2, activebackground= '#202124', activeforeground='#1195cf', relief='ridge', command=Anti_Duplicate)
bouton_2.pack(side= LEFT, padx= 5, pady=5, ipadx= 30)
bouton_3 = HoverButton(mainframe, font=("Arial", 15), text="Split*", background='#1c2028', fg='white', borderwidth=2, activebackground= '#202124', activeforeground='#1195cf', relief='ridge', command=Split)
bouton_3.pack(side= LEFT, padx= 5, pady=5, ipadx= 30)
main_screen.mainloop()
main_menu() |
Partager