[Tutor] please help me with after method

2016-11-16 Thread Freedom Peacemaker
Hi, i need help. I am using Python 3.4 and I have wrote little app for
windows only ( windows 7 and higher). Its timer and my app working but not
good. Some people said that i should use after method instead of update()
and nobody told me how. Ive tried many times but i dont know how do it
correctly. Please help me improve my app.

When you run app first enter minutes in entry then press start. If you
first press start your pc will shutdown with no time to stop it

my code:

from tkinter import *
import tkinter as tk
import time, os

def startCount():
setTime = setMinutes.get() * 60
strTime = str(setTime)
timeSet = ("\""+"shutdown /s /f /t " +strTime+"\"")
os.system(timeSet)
for t in range(setTime, -1, -1):
lcd = "{:02d}:{:02d}".format(*divmod(t, 60))
timeString.set(lcd)
try:
root.update()
except TclError:
messagebox.showinfo('Info', 'Closing app wont stop timer.')
return
time.sleep(1)
return

root = tk.Tk()
setMinutes = IntVar()
timeString = StringVar()
label_font = ('Verdana', 30)
root.geometry('210x120+200+200')
root.title('Timer v1.0')
root.resizable(0, 0)

L1 = tk.Label(root, text='How much time you have?')
L1.grid(row=0, columnspan=3, sticky='WE')

L2 = tk.Label(root, textvariable=timeString, font=label_font, bg='white',
 fg='orange', relief='raised', bd=3)
L2.grid(row=1, columnspan=3, sticky='WE', padx=5, pady=5)

E1 = tk.Entry(root, textvariable=setMinutes).grid(row=2, column=1, padx=5,
pady=5)

B1 = tk.Button(root, text='S T A R T', fg='green', bg='black',
command=startCount)
B1.grid(row=2, rowspan=2, sticky='NS', column=0, padx=5, pady=5)

root.mainloop()
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] randomly generated error

2017-01-27 Thread Freedom Peacemaker
Hi,
main idea was to :
- get random characters word
- randomly colour letters in my word
- from this coloured word print all yellow letters

As it is random i need to be sure that at least one letter is yellow so i
put yellow color into final variable. This code works but randomly
generates error. And i have no idea how solve this problem. Please help me

Traceback (most recent call last):
  File "proj3", line 23, in 
w = "".join((colorpass[i.end()]) for i in re.finditer(re.escape(Y),
colorpass))
  File "proj3", line 23, in 
w = "".join((colorpass[i.end()]) for i in re.finditer(re.escape(Y),
colorpass))
IndexError: string index out of range

This is my code:

from random import choice
from string import ascii_letters, digits
import re

chars = ascii_letters + digits

word = "".join([choice(chars) for i in range(10)])

R = '\033[31m'  # red
G = '\033[32m'  # green
B = '\033[34m'  # blue
P = '\033[35m'  # purple
Y = '\033[93m'  # yellow

colors = [R, G, B, P, Y]

colorpass = "\033[93m"
for char in word:
colorpass += char + choice(colors)
print(colorpass)

w = "".join((colorpass[i.end()]) for i in re.finditer(re.escape(Y),
colorpass))
print(w)

I am using Python 3.5.2 on Ubuntu 16.04
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] GUI for ANSI colors

2017-02-13 Thread Freedom Peacemaker
Hi tutor,
I'm trying to put my script with randomly colored letters (ANSI escape
code) into GUI but cant find any. I've tried tkinter but it isn't good
choice. Then i was searching for capabilities of PyQt4 again without
success. Thats why im writing this message. Is there any GUI that can print
word with randomly colored letters?
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Which DB use with standalone desktop app

2017-07-06 Thread Freedom Peacemaker
Hi Tutors,
I am working on standalone desktop app with tkinter GUI (Python3), and i
dont know which database should i use. I've tried to find solution on my
own but google cant help me. There are some with SQL in name (eg. sqlite3,
MySql), but there are some other NoSql like MongoDB or Redis. Please help
me which one i should use for my app not only from ones i've mentioned. My
database will have max 100 records described by 6-8 columns. Most of them
will be 25 characters max but one will have up to 60.

Thanks for help,
PP


Wolny
od wirusów. www.avast.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] accessing buttons (tkinter) made with loop

2018-06-14 Thread Freedom Peacemaker
Hello Tutor,
currently im working with tkinter application. Main idea was to create 25
buttons with for loop. Each button text was random number and user needs to
click them in order form lowest to highest. When button is clicked its
being disabled with coresponding color (green-ok, red-not). This is my code:

http://pastebin.pl/view/1ac9ad13

I was looking for help in Google but now i cant figure out, how to move
forward. I am stuck.

Buttons with numbers are created, and all buttons (key) with their numbers
(value) are added to buttons dictionary. So objects are created with
coresponding values. And now is my problem. I tried with use() function /it
gives me only errors painting few buttons to green, one not painted and
rest is red/ but i have no idea how i could access configuration of those
buttons. I think im close but still can see. Can You guide me?

Best Regards
Pi
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor