User Profile

Collapse

Profile Sidebar

Collapse
katyalrikin
katyalrikin
Last Activity: Jan 10 '15, 12:01 AM
Joined: Sep 23 '14
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • How to check if string is made up of only certain letters

    Code:
    sent = raw_input()
    if sent.__contains__("S" or "I" or "H" or "X" or "O" or "N" or "Z"):
        print("YES")
    else:
        print("NO")
    This is what I have. If each letter in sent is in that list, print YES else print NO. But as long as i have 1 from the list it prints YES. That is not what I want. How can i fix this?
    See more | Go to post

  • katyalrikin
    started a topic How to validate entry is alphanumeric,Tkinter

    How to validate entry is alphanumeric,Tkinter

    I have an entry that i would like to make sure that it is only alphanumeric. how can i do so?
    Code:
    def validate_code(var):
        new_value = var.get()
        try:
            new_value == '' or int(new_value)
            validate_code.old_value = new_value
        except:
            var.set(validate_code.old_value)
    This is what I have so far. I already check if it is an int, now how to check...
    See more | Go to post

  • katyalrikin
    started a topic How to change value of label in Tkinter

    How to change value of label in Tkinter

    I want to change the text in a label everytime the button is clicked and the command is called. Here is my code:
    Code:
    from Tkinter import *
    from random import *
    
    def background():
        x = randrange(255)
        y = randrange(255)
        z = randrange(255)
        rgb_color = [x,y,z]
        mycolor = '#%02x%02x%02x' % (x, y, z)
        app.configure(bg=mycolor)
        label1 = Label(app, text=rgb_color)
    ...
    See more | Go to post
    Last edited by bvdet; Sep 23 '14, 11:52 PM. Reason: Please use code tags when posting code [code].......[/code]
No activity results to display
Show More
Working...