
Enviado em 26/06/2018 - 16:07h
Estou criando um programa de bloco de notas em Python usando o Tkinter, vejam o progresso:# charset = "UTF-8"
import tkinter as tk
from tkinter import filedialog
"""
from ScrolledText import ScrolledText
area = ScrolledText.ScrolledText("formulario", height=10, width=40)
"""
def acesso():
print("oi")
def aa():
global filename
filename = filedialog.askopenfilename()
if filename != "":
open(filename, 'w')
def sa():
global filename
global arq
filename = filedialog.asksaveasfilename()
arq = open(filename, 'w')
arq.write(ed_1.get())
filename.close()
j_1 = tk.Tk()
j_1.title("Sem titulo")
j_1.geometry("750x500+200+100")
ed_1 = tk.Text(height=19, width=68, font=("Calibri", 16))
ed_1.text = "okfrfkjfklkbm"
ed_1.place(x=1, y=0)
m_1 = tk.Menu(j_1)
j_1.config(menu=m_1)
# ================================================
sm_1 = tk.Menu(m_1)
m_1.add_cascade(label="Arquivo", menu=sm_1)
sm_1.add_command(label="Novo", command=acesso)
sm_1.add_command(label="Abrir", command=aa)
sm_1.add_separator()
sm_1.add_command(label="Salvar", command=acesso)
sm_1.add_command(label="Salvar como", command=sa)
sm_1.add_separator()
sm_1.add_command(label="Sair", command=acesso)
# ================================================
sm_2 = tk.Menu(m_1)
m_1.add_cascade(label="Editar", menu=sm_2)
sm_2.add_command(label="Desfazer", command=acesso)
sm_2.add_command(label="Excluir", command=acesso)
sm_2.add_separator()
sm_2.add_command(label="Copiar", command=acesso)
sm_2.add_command(label="Colar", command=acesso)
sm_2.add_command(label="Recortar", command=acesso)
sm_2.add_separator()
sm_2.add_command(label="Selecionar tudo", command=acesso)
# =================================================
sm_3 = tk.Menu(m_1)
m_1.add_cascade(label="Opções", menu=sm_3)
sm_3.add_command(label="Fonte", command=acesso)
j_1.mainloop()
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\tkinter\__init__.py", line 1702, in __call__
return self.func(*args)
File "C:/Users/Vitor Daniel/PycharmProjects/untitled1/bdn.py", line 28, in sa
arq.write(ed_1.get())
TypeError: get() missing 1 required positional argument: 'index1'
KDE Plasma - porque pode ser a melhor opção de interface gráfica
Gentoo: detectando impressoras de rede e como fixar uma impressora por IP
Como o GNOME conseguiu o feito de ser preterido por outras interfaces gráficas
Por que sua empresa precisa de uma PKI (e como automatizar EMISSÕES de certificados via Web API)
Instalando NoMachine no Gentoo com Systemd (acesso Remoto em LAN)
Gentoo: Trocando wpa_supplicant pelo iwd no NetworkManager (Systemd)
Instalar Linux em notebook Sony Vaio VPCEG13EB (10)
Vou destruir sua infância:) (6)
Quando vocês pararam de testar distros? (24)









