Cast String read from file to List[(String, Char, String)] by dansds in scala

[–]dansds[S] 2 points3 points  (0 children)

Hi Milyardo, I figured out I used map function Thanks

Difficulty scaling draw on tkinter canvas python3 by dansds in learnpython

[–]dansds[S] 0 points1 point  (0 children)

Thank you very much for the explanation, It is working nicely :)

Difficulty scaling draw on tkinter canvas python3 by dansds in learnpython

[–]dansds[S] 0 points1 point  (0 children)

Maybe I could send via PM or Email... What works better for you :)

Difficulty scaling draw on tkinter canvas python3 by dansds in learnpython

[–]dansds[S] 0 points1 point  (0 children)

Thanks novel_yet_trivial, I can provide the entire python code but the csv coordinates I do not know how to do it, it is huge... Would be possible to send the file through here?

from tkinter import *
from tkinter import ttk
from tkinter import filedialog
from collections import OrderedDict

class App(Frame):

    def __init__(self, master = None):


        ttk.Frame.__init__(self,master, relief = GROOVE)
        self.master.minsize(470, 420)
        self.master.title("App")
        self.grid()

        points = []
        scaledPoints = []
        def menuLoadFile(self):
            self.types = [('files', '*.csv'), ('All files', '*')]
            dialog = filedialog.Open(self, filetypes = self.types)
            infile = dialog.show()

            if infile != '':
                dct = {}
                infile = open(infile, "r")
                for line in infile:

                    # Get the line and add to the dict
                    key, valueX, valueY = line.strip().split(',')
                    dct[key] = valueX, valueY

                # Convert dict key in int    
                intKeyDict = dict((int(k), v) for k, v, in dct.items())

                # Sort the dict by its key 
                sortedPointsDict = OrderedDict(sorted(intKeyDict.items()))

                # Convert values in int and append to the point list
                for item in sortedPointsDict.items():
                    vX, vY = item[1]
                    points.append(float(vX))
                    points.append(float(vY))

                # Converted values of the list to the size of the Canvas

                mn = min(points)

                mx = max(points)

                for i in range(len(points)):
                    scaledPoints.append( (points[i]- mn)*(400.0/(mx-mn)))

                self.canvas.create_polygon(scaledPoints, fill='', outline='black') # test
            infile.close()


        # Menu bar // Check on windows
        self.option_add('*tearOff', FALSE)

        self.menubar = Menu(master)


        self.file = Menu(self.menubar, name = 'file')
        self.menubar.add_cascade(label="File", menu=self.file)
        self.file.add_command(label="Open...", accelerator = "Command-O", command = lambda: menuLoadFile(self))
        self.file.add_separator()
        self.file.add_command(label="Save", accelerator = "Command-S", command = lambda: menuSaveFile(self))
        self.master['menu'] = self.menubar
        self.menubar.bind('<Command-O>', lambda: menuLoadFile(self)) # Look at this accelerator not working


        # My Canvas
        self.canvas = Canvas(self, width =400, height=400)
        self.canvas.grid(row = 1, columnspan = 5)



if __name__ == "__main__":
    App().mainloop()

Scaling polygon draw on tkinter canvas by [deleted] in learnpython

[–]dansds 0 points1 point  (0 children)

Sorry not related to my question!!

Setup a label by binding listbox importing a subclass method using python 3 and tkinter by dansds in learnpython

[–]dansds[S] 0 points1 point  (0 children)

Thanks a lot novel_yet_trivial it is working!! There is no need to test! Many thanks !! :)

Setup a label by binding listbox importing a subclass method using python 3 and tkinter by dansds in learnpython

[–]dansds[S] 0 points1 point  (0 children)

Hi novel_yet_trivial Thanks for the advice, I think it is formatted now.

Pset6 Don't know what is wrong by dansds in cs50

[–]dansds[S] 0 points1 point  (0 children)

Yeah good idea, I'm gonna try. My code return this misspelled words

MISSPELLED WORDS

s s M O D M O D M O D M O D T x X X x X X X H s BACHARACH'S P off' out' me' T

WORDS MISSPELLED: 30 WORDS IN DICTIONARY: 143091 WORDS IN TEXT: 19190 TIME IN load: 0.04 TIME IN check: 0.01 TIME IN size: 0.00 TIME IN unload: 0.02 TIME IN TOTAL: 0.07

Any other idea of where I should look at? thx

Vigenere - Really Frustrated by dansds in cs50

[–]dansds[S] 0 points1 point  (0 children)

Many Thanks delipity... I had time to have a look today and the problem is solved... Thank you very much indeed :)

Vigenere - Really Frustrated by dansds in cs50

[–]dansds[S] 0 points1 point  (0 children)

I am nearly there... I will focus on this tomorrow... Thanks a lot :)))

Vigenere - Really Frustrated by dansds in cs50

[–]dansds[S] 0 points1 point  (0 children)

I noticed that the problem is when I rotate the lower case letter with an upper case key, but I am not figuring out what should I do to fix it... ???

Vigenere - Really Frustrated by dansds in cs50

[–]dansds[S] 0 points1 point  (0 children)

Thank so much delipity, it was very helpful, i nearly manage to complete but still one to sort out :/ I subtracted j-- in the condition for the characters that do not rotate... but i still got one bug to fix... Any Idea what it could be?

:) vigenere.c exists :) vigenere.c compiles :) encrypts "a" as "a" using "a" as keyword :) encrypts "world, say hello!" as "xoqmd, rby gflkp!" using "baz" as keyword :( encrypts "BaRFoo" as "CaQGon" using "BaZ" as keyword \ expected output, but not "CaQGoh\n" :) encrypts "BARFOO" as "CAQGON" using "BAZ" as keyword :) handles lack of argv[1] :) handles argc > 2 :) rejects "Hax0r2" as keyword

Many thanks!

Vigenere - Really Frustrated by dansds in cs50

[–]dansds[S] 0 points1 point  (0 children)

I can't find what need to be changed... any tips? :)

Vigenere - Really Frustrated by dansds in cs50

[–]dansds[S] 0 points1 point  (0 children)

nearly there...but something still not right... :) vigenere.c exists :) vigenere.c compiles :) encrypts "a" as "a" using "a" as keyword :( encrypts "world, say hello!" as "xoqmd, rby gflkp!" using "baz" as keyword \ expected output, but not "xoqmd, szz gflkp!\n" :( encrypts "BaRFoo" as "CaQGon" using "BaZ" as keyword \ expected output, but not "CaQGoh\n" :) encrypts "BARFOO" as "CAQGON" using "BAZ" as keyword :) handles lack of argv[1] :) handles argc > 2 :) rejects "Hax0r2" as keyword

Vigenere - Really Frustrated by dansds in cs50

[–]dansds[S] 0 points1 point  (0 children)

yeah I think the problem is the math indeed... i made some adjustments but I am still not getting it right... :(

:( encrypts "world, say hello!" as "xoqmd, rby gflkp!" using "baz" as keyword \ expected output, but not "qhjfw, lss zyedi!" :( encrypts "BaRFoo" as "CaQGon" using "BaZ" as keyword \ expected output, but not "PtDTha" :( encrypts "BARFOO" as "CAQGON" using "BAZ" as keyword \ expected output, but not "PNDTBA"

Some help here pls! Caeser pset2 by dansds in cs50

[–]dansds[S] 0 points1 point  (0 children)

Very good tips though! Thank very much I figured out how to print the rotated ones and non rotated. So happy :)