Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'tk'
- class Startbildschirm
- #######################
- #### RUN ##############
- #######################
- def run
- @startbildschirm.overrideredirect(true)
- @startbildschirm.mainloop
- end
- ########################
- #### initialize ########
- ########################
- def initialize
- #root#
- @startbildschirm = TkRoot.new(:title => 'Startbildschirm','height' => 1050, 'width' => 1400) do
- root.geometry('+0+0')
- end
- hintergrund()
- herunterfahren()
- benutzer()
- end
- #############
- #hintergrund#
- #############
- def hintergrund
- TkLabel.new('height' => 1050, 'width' => 1400) do
- place 'x' => -2, 'y' => -2
- image1 = TkPhotoImage.new do
- file "data/Wald.gif"
- end
- image image1
- end
- end
- ###############
- #heruntefahren#
- ###############
- def herunterfahren
- button = TkButton.new('height' => 42, 'width' => 42) do
- place 'x' => 1350, 'y' => 1000
- image1 = TkPhotoImage.new do
- file "data/Aus.gif"
- end
- image image1
- end
- button.bind('ButtonRelease-1') do
- exit
- end
- end
- ##########
- #Benutzer#
- ##########
- def benutzer
- @yaml_file = File.new 'data/Benutzer.txt'
- @benutzer = YAML.load(@yaml_file)
- @yaml_file.close
- moep = 0
- @benutzer.each do
- moep += 1
- end
- if moep == 1
- zahl1 = 500
- elsif moep == 2
- zahl1 = 400
- elsif moep == 3
- zahl1 = 300
- elsif moep == 4
- zahl1 = 200
- end
- @benutzer.each do |benutzer, zahl|
- zahl1 += 180
- benutzer1 = benutzer
- benutzer1 = TkButton.new('height' => 50, 'width' => 49) do
- place 'x' => zahl1, 'y' => 500
- text "#{benutzer}"
- font TkFont.new('times 18 bold')
- image1 = TkPhotoImage.new do
- file "data/icon.gif"
- end
- image image1
- relief 'flat'
- activebackground 'black'
- cursor "hand2"
- end
- benutzer1.bind('ButtonRelease-1') do
- end
- TkLabel.new('height' => 1, 'width' => 7) do
- place 'x' => zahl1, 'y' => 555
- text "#{benutzer}"
- background 'green'
- font TkFont.new('times 10 bold')
- foreground 'red'
- end
- end
- end
- reymo = Startbildschirm.new
- reymo.run
- end
Add Comment
Please, Sign In to add comment