Python Forum
[Tkinter] Some question
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Some question
#1
Hello, I'm a french who want to create something for my Casio (it's calc)
In fact, you can made some draw but it's pretty long and hard.
That's why I want to create with Python a GUI who recreate my calculator's screen (127x63)
I want to make :
GUI of ALL screen, when you touch one pixel, it color change to black.
When you have finish, you can create .txt with your "art" for Casio. (Plotln x,y) Of course, only the black pixel.

For the moment, I have this :
# coding: utf-8
from tkinter import *
import tkinter as tk
from tkinter.messagebox import *

main = Tk()
main.geometry("500x400+500+250")
main.title('1er version')
main['bg'] = 'white'
nomfichier = 'CasioMaker.txt'

def a():
    fichier = open(nomfichier, 'w')
    fichier.write('\'Made by Tituya\n')
    fichier.write('Cls\n')
    fichier.write('ViewWindow 1,127,1,1,63,1\n')
    fichier.write('AxesOff\n')
    fichier.close()
    
def c():
    for ligne1 in range(10):
        for colonne1 in range(10):
            button = tk.Button(main, borderwidth=1, background='white', width=2, height=1)
            button['command'] = lambda button=button: button.configure(background = 'black')
            button.grid(row=ligne1, column=colonne1)
            
def b():
    if askyesno('Titre 1', 'Etes vous sur ? Toutes progression sera éffacée'):
        main.quit()
    else:
        pass


for ligne in range(10):
    for colonne in range(10):
        button = tk.Button(main, borderwidth=1, background='white', width=2, height=1)
        button['command'] = lambda button=button: button.configure(background = 'black')
        button.grid(row=ligne, column=colonne)
            
            
menu = Menu(main)
sousmenu = Menu(menu, tearoff=0)
menu.add_cascade(label="Menu", menu=sousmenu)
sousmenu.add_command(label="Creer le fichier texte", command=a)
sousmenu.add_command(label="Quitter", command=b)
menu.add_command(label="Effacer", command=c)
main.config(menu = menu)


main.mainloop()
But, for the moment It's only some button and, if I want to do the screen, the button are too big for the screen. (Maybe scrollbar ?)
And how can I pick up information about the color of the button ? $

Sorry about my bad English.

Tituya Idea
Reply
#2
This is old, but: https://python-forum.io/Thread-Tkinter-V...675#pid675
And image of results in post 8, same thread
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020