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'
Conciliando o uso da ZRAM e SWAP em disco na sua máquina
Servidor de Backup com Ubuntu Server 24.04 LTS, RAID e Duplicati (Dell PowerEdge T420)
Visualizar câmeras IP ONVIF no Linux sem necessidade de instalar aplicativos
Proteja seu Linux Mint com o Timeshift: Restaure o sistema mesmo que ele não inicie!
Instalando Google Chrome no Debian 13
Erro de interface de Rede no Virt Manager dentro Debian 13 KDE (10)
paginação dos favoritos não funciona no vivaolinux[BU... (5)