Advertisement
Guest User

Untitled

a guest
Aug 27th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.93 KB | None | 0 0
  1. # import the library
  2. from appJar import gui
  3. from os import listdir
  4.  
  5.  
  6. # grid tip
  7. # "row=1 column=2 colspan=1 rowspan=2", 1, 2, 1, 2)
  8.  
  9. # handle button events
  10. def press(button):
  11.     if button == "Cancel" or button == "Выход":
  12.         app.stop()
  13.     elif button == "Выбрать":
  14.         name = app.getListItems("list")[0]
  15.         app.setLabel("header", name[:-4])
  16.         otv=open(name).readlines()[0].split(";")
  17.         app.setLabel("main_phrase", otv[0])
  18.         app.setButton("ы", otv[1])
  19.         app.setButton("и", otv[2])
  20.     elif button == "ы" or button == "и":
  21.        
  22.     else:
  23.         usr = "123"
  24.         pwd = app.getEntry("Password")
  25.         print("User:", usr, "Pass:", pwd)
  26.  
  27. # create a GUI variable called app
  28. app = gui("Dictionary fiesta", "1280x550")
  29. app.setFont(18)
  30. app.setResizable(canResize=False)
  31. app.setStretch("both")
  32.  
  33. # Name of the current file being processed
  34. app.addLabel("header", "Общий диктант на разные правила", row=0, column=0, colspan=2)
  35.  
  36. # Left column with files list and exit buttons
  37. app.startPanedFrame("select_window", row=1, column=0)
  38.  
  39. files = listdir("./")
  40. mytxt = list(filter(lambda x: x.endswith('.txt'), files))
  41.  
  42. app.addListBox("list", mytxt, 1,2,1,2)
  43. app.addButtons(["Выбрать", "Выход"], press, row=3, column=2)
  44. app.stopPanedFrame()
  45. app.getListBoxWidget("list").config(width=1)
  46.  
  47.  
  48. # Right column with main actions
  49. app.startLabelFrame("main_window", row=1, column=1)
  50. app.addLabel("main_phrase", "без_дейный")
  51. app.getLabelWidget("main_phrase").config(font="Times 30", width=30)
  52.  
  53. # variants buttons
  54. app.startPanedFrame("p1")
  55. app.addButtons(["ы", "и"], press)
  56. app.stopPanedFrame()
  57.  
  58. app.setLabelSticky("main_phrase", "wns")
  59. app.setPanedFrameSticky("p1", "ew")
  60. app.stopLabelFrame()
  61.  
  62. app.setPanedFrameSticky("select_window", "nsw")
  63. app.setLabelFrameSticky("main_window", "nsew")
  64.  
  65. # start the GUI
  66. app.go()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement