"Meanwhile" may have the same meaning as one definition of "while", but it's not this definition. (Even though I don't think you can use "meanwhile" as a conjunction like "while".)
"Meanwhile" and "while" are referring to a timeframe - thing A happens during the time of thing B. "The cats thrashed our laundry while we were asleep." Can be translated as közben.
Pedig, on the other hand, is contrasting something - here's thing A, and here's thing B which is different. "My favourite mug is the pink one, while the others have only boring colours." It can be expressed with various conjunctions in English - whereas, while, and, but.
in previous sentences this sentence structure has always been translated with a "but".
"but" in general is "de" in Hungarian. "hanem" also means "but", but not in this situation. It is "sondern" in German, if that helps you at all. It is used in sentences like "it is not red, but blue".
Good job. :)
But Dragoncurve - wonderful name, by the way - is pretty correct with that statement. De is the Hungarian word that encompasses the meaning of "but" in the most general sense: thing A happens, which is bad for thing B, but thing B happens regardless.
And then there are the other words that can translate to "but" in English but have more specific applications.
Hanem occurs when thing A does not happen, but instead thing B happens. That means if thing B happens, thing A cannot happen, B replaces A.
You can replace hanem by de in pretty much any sentence, changing the meaning from "but rather" to something more like "but at least".
- Nem Katit láttam, hanem téged. - I expected to see Kati, but instead I found you.
- Nem Katit láttam, de téged. - I didn't see Kati, but at least you are here.
Pedig or meg appear in comparisons. Thing A happens, and thing B happens in a similar, but kind of opposite fashion. The clauses A and B often have different topics. These conjunctions don't have that feeling of A hindering B that the use of de suggests, but are more neutral.
- A madarak elszállnak, a nyulak pedig megmaradnak. - The birds are flying away, but/and/while the rabbits stay.
- A madarak elszállnak, de a nyulak megmaradnak. - The birds are flying away, and yet the rabbits stay.