Ich hab mal gestoppt ich brauche 39.1 Sekunden.
Code: Alles auswählen
self.BACKGROUND_COLOR = '#000000'
self.TEXT_COLOR = '#00ff00'
self.window = tkinter.Toplevel(bg=self.BACKGROUND_COLOR)
self.window.title('Minecraft remote console client ' + version)
self.window.protocol("WM_DELETE_WINDOW", exit_func)
self.window.wm_iconbitmap(os.path.join(icon_path, 'icon.ico'))
self.window.resizable(0, 0)
tkinter.Label(self.window, text='Host:', bg=self.BACKGROUND_COLOR, fg=self.TEXT_COLOR).grid(row=0, column=0)
self.host_entry = tkinter.Entry(self.window, width=30, bg=self.BACKGROUND_COLOR, fg=self.TEXT_COLOR, insertbackground=self.TEXT_COLOR)
self.host_entry.grid(row=0, column=1)
tkinter.Label(self.window, text='Port:', bg=self.BACKGROUND_COLOR, fg=self.TEXT_COLOR).grid(row=0, column=2)
self.port_entry = tkinter.Entry(self.window, width=6, bg=self.BACKGROUND_COLOR, fg=self.TEXT_COLOR, insertbackground=self.TEXT_COLOR)
self.port_entry.grid(row=0, column=3)
self.port_entry.insert('end', '25575')
tkinter.Label(self.window, text='Passwort:', bg=self.BACKGROUND_COLOR, fg=self.TEXT_COLOR).grid(row=0, column=4)
self.password_entry = tkinter.Entry(self.window, width=20, show='*', bg=self.BACKGROUND_COLOR, fg=self.TEXT_COLOR, insertbackground=self.TEXT_COLOR)
self.password_entry.grid(row=0, column=5)
tkinter.Frame(self.window, width=15, height=1, bg=self.BACKGROUND_COLOR).grid(row=0, column=6) #erzeugt 15 pixel abstand zum button
self.connect_button = tkinter.Button(self.window, text='Verbinden', bg=self.BACKGROUND_COLOR, fg=self.TEXT_COLOR, activeforeground='#000000',
activebackground=self.TEXT_COLOR, command=self.connect)
self.connect_button.grid(row=0, column=7, columnspan=2, ipadx=10, sticky='ew')
self.connect_button.bind("<Return>", self.connect)
self.textframe = tkinter.Frame(self.window)
self.textframe.grid(row=2, column=0, columnspan=8) #row=2 weil viellicht noch ein zwischen raum eingefügt werden soll
self.scrollbar = tkinter.Scrollbar(self.textframe, bg=self.BACKGROUND_COLOR, troughcolor=self.TEXT_COLOR)
self.scrollbar.grid(row=0, column=1, sticky='nse')
self.output_text = tkinter.Text(self.textframe, height=15, state='disable', bg=self.BACKGROUND_COLOR, yscrollcommand=self.scrollbar.set)
self.output_text.grid(row=0, column=0, sticky='w')
self.scrollbar.config(command=self.output_text.yview)
for tag_name in self.colors_and_styles:
if not self.colors_and_styles[tag_name][1] is None:
self.output_text.tag_config(tag_name, foreground=self.colors_and_styles[tag_name][1], background=self.colors_and_styles[tag_name][2])
self.output('§4[info]§r: -help eigeben um befehlsübersicht anzuzeigen')
## self.output('§0T§1T§2T§3T§4T§5T§6T§7T§8T§9T§aT§bT§cT§dT§eT§fT')
## self.output('§4R§6e§eg§ae§bn§3b§1o§5g§4e§cn')
tkinter.Label(self.window, text='Farben:', bg=self.BACKGROUND_COLOR, fg=self.TEXT_COLOR).grid(row=3, column=0)
self.command_entry = tkinter.Entry(self.window, bg=self.BACKGROUND_COLOR, fg=self.TEXT_COLOR, insertbackground=self.TEXT_COLOR)
self.font_style_Frame = tkinter.Frame(self.window)
self.font_style_Frame.grid(row=3, column=1, columnspan=5, sticky='e')
self.font_style_var = tkinter.StringVar()
column_count = 0
for tag_name in self.colors_and_styles:
if tag_name == 'r':
tkinter.Button(self.font_style_Frame, text='N', width=2, relief='groove',
bg=self.BACKGROUND_COLOR, fg=self.TEXT_COLOR,
activeforeground=self.BACKGROUND_COLOR,
activebackground=self.TEXT_COLOR,
command=functools.partial(self.command_entry.insert, 'insert', '§'+tag_name)).grid(row=0, column=column_count)
elif not self.colors_and_styles[tag_name][1] is None:
tkinter.Button(self.font_style_Frame, text=tag_name, foreground=self.colors_and_styles[tag_name][1],
background=self.colors_and_styles[tag_name][1],
activeforeground=self.colors_and_styles[tag_name][1],
activebackground=self.colors_and_styles[tag_name][1],
width=2, relief='groove',
command=functools.partial(self.command_entry.insert, 'insert', '§'+tag_name)).grid(row=0, column=column_count)
else:
tkinter.Button(self.font_style_Frame, text=self.colors_and_styles[tag_name][2],
width=2, relief='groove',
bg=self.BACKGROUND_COLOR,
fg=self.TEXT_COLOR,
activeforeground=self.BACKGROUND_COLOR,
activebackground=self.TEXT_COLOR,
command=functools.partial(self.command_entry.insert, 'insert', '§'+tag_name)).grid(row=0, column=column_count)
column_count += 1
tkinter.Button(self.window, text='Verbindung trennen', bg=self.BACKGROUND_COLOR, fg=self.TEXT_COLOR, activeforeground=self.BACKGROUND_COLOR,
activebackground=self.TEXT_COLOR, command=self.disconnect).grid(row=3, column=0, columnspan=8, sticky='e')
self.command_entry.grid(row=4, column=0, columnspan=8, sticky='ew')
self.command_entry.bind("<Return>", self.sendcommand)
Und jetzt nur noch 7.5 sekunden.
Ich habe jetzt noch mal versucht die Farben beim Scrollbar zu ändern aber es geht nicht.