Question: So I'm trying to use a KeyBoardEvent honestly just for testing purposes.. what I'm doing does not seem to be working :/ Hopefully you guys can tell me where I'm derping. Thanks! 

```
package com.dillyg10.test.Keys;

import java.awt.Window;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

public class Keys extends JPanel implements KeyListener  {
    private static final long serialVersionUID = 1L;

    public Keys(){

    }

    public static void registerEvent(Window w){
        w.setFocusTraversalKeysEnabled(false);
        w.setFocusable(true);
        w.addKeyListener(new Keys());
    }
    public void keyPressed(KeyEvent e) {
        System.out.println(KeyEvent.getKeyText(e.getKeyCode()));
    }
    public void keyReleased(KeyEvent e) {

    }
    public void keyTyped(KeyEvent e) {

    }
    public static void gui() {

        JFrame frame = new JFrame("Keys");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        registerEvent(new Window(frame));

        //Display the window.
        frame.pack();
        frame.setVisible(true);
    }

    public static void main(String[] args){
        SwingUtilities.invokeLater(new Runnable(){
            public void run(){
                gui();
            }
        });
     }
    }

```

This code is basically a test to determine if the keyboardevents work, i jsut print out the key when it's pressed.. but nothing is printed.

Answer: 
You can seek in Python as well - the answer you linked is just pointing that you can't *insert* in the middle of a file (`ABC` -> `ABXC`).

If you seek and then write, whatever data is written **overwrites** the contents at that position of the file (`ABC` -> `AXC`).
Of course you can edit a file in place:

```
import struct
RECSIZE = struct.calcsize('<i')

fp = open('name.txt', 'r+b')
fp.seek(132 * RECSIZE)   # go to record number 132
fp.write(struct.pack('<i', 42))
fp.seek(132 * RECSIZE)
assert struct.unpack('<i', fp.read(RECSIZE)) == 42

```

this also shows the most common reason for doing so and the limitations.